/** * Construct a new key for a collection or entity instance. * Note that an entity name should always be the root entity * name, not a subclass entity name. * * @param id The identifier associated with the cached data * @param type The Hibernate type mapping * @param entityOrRoleName The entity or collection-role name. * @param tenantId The tenant identifier associated this data. */ public CacheKeyImpl( final Object id, final Type type, final String entityOrRoleName, final String tenantId, final SessionFactoryImplementor factory) { this.id = id; this.type = type; this.entityOrRoleName = entityOrRoleName; this.tenantId = tenantId; this.hashCode = calculateHashCode(type, factory); }
@Override public Object getEntityId(Object cacheKey) { return ((CacheKeyImpl) cacheKey).getId(); }
@Override public Object createCollectionKey(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantId) { return new CacheKeyImpl(id, persister.getKeyType(), persister.getRole(), tenantId, factory); }
@Override public Object createEntityKey(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) { return new CacheKeyImpl(id, persister.getIdentifierType(), persister.getRootEntityName(), tenantIdentifier, factory); }
@Override public Object createCollectionKey(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantId) { return new CacheKeyImpl(id, persister.getKeyType(), persister.getRole(), tenantId, factory); }
@Override public Object getCollectionId(Object cacheKey) { return ((CacheKeyImpl) cacheKey).getId(); }
/** * Construct a new key for a collection or entity instance. * Note that an entity name should always be the root entity * name, not a subclass entity name. * * @param id The identifier associated with the cached data * @param type The Hibernate type mapping * @param entityOrRoleName The entity or collection-role name. * @param tenantId The tenant identifier associated this data. */ public CacheKeyImpl( final Object id, final Type type, final String entityOrRoleName, final String tenantId, final SessionFactoryImplementor factory) { this.id = id; this.type = type; this.entityOrRoleName = entityOrRoleName; this.tenantId = tenantId; this.hashCode = calculateHashCode(type, factory); }
@Override public Object createEntityKey(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantId) { return new CacheKeyImpl(id, persister.getIdentifierType(), persister.getRootEntityName(), tenantId, factory); }
@Override public Object getCollectionId(Object cacheKey) { return ((CacheKeyImpl) cacheKey).getId(); }
/** * Construct a new key for a collection or entity instance. * Note that an entity name should always be the root entity * name, not a subclass entity name. * * @param id The identifier associated with the cached data * @param type The Hibernate type mapping * @param entityOrRoleName The entity or collection-role name. * @param tenantId The tenant identifier associated this data. */ public CacheKeyImpl( final Object id, final Type type, final String entityOrRoleName, final String tenantId, final SessionFactoryImplementor factory) { this.id = id; this.type = type; this.entityOrRoleName = entityOrRoleName; this.tenantId = tenantId; this.hashCode = calculateHashCode(type, factory); }
@Override public Object createCollectionKey(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) { return new CacheKeyImpl(id, persister.getKeyType(), persister.getRole(), tenantIdentifier, factory); }
@Override public Object getEntityId(Object cacheKey) { return ((CacheKeyImpl) cacheKey).getId(); }
@Override public Object createEntityKey(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantId) { return new CacheKeyImpl(id, persister.getIdentifierType(), persister.getRootEntityName(), tenantId, factory); }
@Override public Object getEntityId(Object cacheKey) { return ((CacheKeyImpl) cacheKey).getId(); }
@Override public Object getCollectionId(Object cacheKey) { return ((CacheKeyImpl) cacheKey).getId(); }