/** * Construct a unique identifier for an entity class instance. * <p/> * NOTE : This signature has changed to accommodate both entity mode and multi-tenancy, both of which relate to * the Session to which this key belongs. To help minimize the impact of these changes in the future, the * {@link SessionImplementor#generateEntityKey} method was added to hide the session-specific changes. * * @param id The entity id * @param persister The entity persister */ public EntityKey(Serializable id, EntityPersister persister) { this.persister = persister; if ( id == null ) { throw new AssertionFailure( "null identifier" ); } this.identifier = id; this.hashCode = generateHashCode(); }
/** * Used to reconstruct an EntityKey during deserialization. * * @param identifier The identifier value * @param rootEntityName The root entity name * @param entityName The specific entity name * @param identifierType The type of the identifier value * @param batchLoadable Whether represented entity is eligible for batch loading * @param factory The session factory * @param tenantId The entity's tenant id (from the session that loaded it). */ private EntityKey( Serializable identifier, String rootEntityName, String entityName, Type identifierType, boolean batchLoadable, SessionFactoryImplementor factory, String tenantId) { this.identifier = identifier; this.rootEntityName = rootEntityName; this.entityName = entityName; this.identifierType = identifierType; this.isBatchLoadable = batchLoadable; this.factory = factory; this.tenantId = tenantId; this.hashCode = generateHashCode(); }
/** * Used to reconstruct an EntityKey during deserialization. * * @param identifier The identifier value * @param rootEntityName The root entity name * @param entityName The specific entity name * @param identifierType The type of the identifier value * @param batchLoadable Whether represented entity is eligible for batch loading * @param factory The session factory * @param tenantId The entity's tenant id (from the session that loaded it). */ private EntityKey( Serializable identifier, String rootEntityName, String entityName, Type identifierType, boolean batchLoadable, SessionFactoryImplementor factory, String tenantId) { this.identifier = identifier; this.rootEntityName = rootEntityName; this.entityName = entityName; this.identifierType = identifierType; this.isBatchLoadable = batchLoadable; this.factory = factory; this.tenantId = tenantId; this.hashCode = generateHashCode(); }
/** * Construct a unique identifier for an entity class instance. * <p/> * NOTE : This signature has changed to accommodate both entity mode and multi-tenancy, both of which relate to * the Session to which this key belongs. To help minimize the impact of these changes in the future, the * {@link SessionImplementor#generateEntityKey} method was added to hide the session-specific changes. * * @param id The entity id * @param entityDescriptor The entity entityDescriptor */ public EntityKey(Object id, EntityTypeDescriptor entityDescriptor) { this.entityDescriptor = entityDescriptor; if ( id == null ) { throw new AssertionFailure( "null identifier" ); } this.identifier = id; this.hashCode = generateHashCode(); }
/** * Construct a unique identifier for an entity class instance. * <p> * NOTE : This signature has changed to accommodate both entity mode and multi-tenancy, both of which relate to * the Session to which this key belongs. To help minimize the impact of these changes in the future, the * {@link SessionImplementor#generateEntityKey} method was added to hide the session-specific changes. * * @param id The entity id * @param persister The entity persister * @param tenantId The tenant identifier of the session to which this key belongs */ public EntityKey(Serializable id, EntityPersister persister, String tenantId) { if ( id == null ) { throw new AssertionFailure( "null identifier" ); } this.identifier = id; this.rootEntityName = persister.getRootEntityName(); this.entityName = persister.getEntityName(); this.tenantId = tenantId; this.identifierType = persister.getIdentifierType(); this.isBatchLoadable = persister.isBatchLoadable(); this.factory = persister.getFactory(); this.hashCode = generateHashCode(); }
/** * Construct a unique identifier for an entity class instance. * <p> * NOTE : This signature has changed to accommodate both entity mode and multi-tenancy, both of which relate to * the Session to which this key belongs. To help minimize the impact of these changes in the future, the * {@link SessionImplementor#generateEntityKey} method was added to hide the session-specific changes. * * @param id The entity id * @param persister The entity persister * @param tenantId The tenant identifier of the session to which this key belongs */ public EntityKey(Serializable id, EntityPersister persister, String tenantId) { if ( id == null ) { throw new AssertionFailure( "null identifier" ); } this.identifier = id; this.rootEntityName = persister.getRootEntityName(); this.entityName = persister.getEntityName(); this.tenantId = tenantId; this.identifierType = persister.getIdentifierType(); this.isBatchLoadable = persister.isBatchLoadable(); this.factory = persister.getFactory(); this.hashCode = generateHashCode(); }