private SharedSessionContractImplementor getSession() { return getPersistenceContext().getSession(); }
String previousStatusString; return new ImmutableEntityEntry( persistenceContext.getSession().getFactory(), (String) ois.readObject(), (Serializable) ois.readObject(),
String previousStatusString; return new MutableEntityEntry( persistenceContext.getSession().getFactory(), (String) ois.readObject(), (Serializable) ois.readObject(),
private boolean isCached(EntityKey entityKey, EntityPersister persister) { final SharedSessionContractImplementor session = context.getSession(); if ( context.getSession().getCacheMode().isGetEnabled() && persister.canReadFromCache() ) { final EntityDataAccess cache = persister.getCacheAccessStrategy(); final Object key = cache.generateCacheKey( entityKey.getIdentifier(), persister, session.getFactory(), session.getTenantIdentifier() ); return CacheHelper.fromSharedCache( session, key, cache ) != null; } return false; }
@SuppressWarnings( {"SimplifiableIfStatement"}) private boolean isUnequivocallyNonDirty(Object entity) { if ( entity instanceof SelfDirtinessTracker ) { return ! persister.hasCollections() && ! ( (SelfDirtinessTracker) entity ).$$_hibernate_hasDirtyAttributes(); } final CustomEntityDirtinessStrategy customEntityDirtinessStrategy = getPersistenceContext().getSession().getFactory().getCustomEntityDirtinessStrategy(); if ( customEntityDirtinessStrategy.canDirtyCheck( entity, getPersister(), (Session) getPersistenceContext().getSession() ) ) { return ! customEntityDirtinessStrategy.isDirty( entity, getPersister(), (Session) getPersistenceContext().getSession() ); } if ( getPersister().hasMutableProperties() ) { return false; } return false; }
@Override public void postUpdate(Object entity, Object[] updatedState, Object nextVersion) { this.loadedState = updatedState; setLockMode( LockMode.WRITE ); if ( getPersister().isVersioned() ) { this.version = nextVersion; getPersister().setPropertyValue( entity, getPersister().getVersionProperty(), nextVersion ); } if( entity instanceof SelfDirtinessTracker ) { ( (SelfDirtinessTracker) entity ).$$_hibernate_clearDirtyAttributes(); } getPersistenceContext().getSession() .getFactory() .getCustomEntityDirtinessStrategy() .resetDirty( entity, getPersister(), (Session) getPersistenceContext().getSession() ); }
private boolean isCached(Serializable collectionKey, CollectionPersister persister) { SharedSessionContractImplementor session = context.getSession(); if ( session.getCacheMode().isGetEnabled() && persister.hasCache() ) { CollectionDataAccess cache = persister.getCacheAccessStrategy(); Object cacheKey = cache.generateCacheKey( collectionKey, persister, session.getFactory(), session.getTenantIdentifier() ); return CacheHelper.fromSharedCache( session, cacheKey, cache ) != null; } return false; }
final SharedSessionContractImplementor session = getLoadContext().getPersistenceContext().getSession(); if ( !loadContexts.hasLoadingCollectionEntries() && localLoadingCollectionKeys.isEmpty() ) {
private void checkNotAssociatedWithOtherPersistenceContextIfMutable(ManagedEntity managedEntity) { // we only have to check mutable managedEntity final AbstractEntityEntry entityEntry = (AbstractEntityEntry) managedEntity.$$_hibernate_getEntityEntry(); if ( entityEntry == null || !entityEntry.getPersister().isMutable() || entityEntry.getPersistenceContext() == null || entityEntry.getPersistenceContext() == persistenceContext ) { return; } if ( entityEntry.getPersistenceContext().getSession().isOpen() ) { // NOTE: otherPersistenceContext may be operating on the entityEntry in a different thread. // it is not safe to associate entityEntry with this EntityEntryContext. throw new HibernateException( "Illegal attempt to associate a ManagedEntity with two open persistence contexts. " + entityEntry ); } else { // otherPersistenceContext is associated with a closed PersistenceContext log.stalePersistenceContextInEntityEntry( entityEntry.toString() ); } }
final String entityName = persistenceContext.getSession().guessEntityName( object ); if ( entityName != null ) { try { persister = persistenceContext.getSession().getFactory().getEntityPersister( entityName );
private void endLoadingCollection(LoadingCollectionEntry lce, CollectionPersister persister) { LOG.tracev( "Ending loading collection [{0}]", lce ); final SharedSessionContractImplementor session = getLoadContext().getPersistenceContext().getSession();
loadContexts.getPersistenceContext().getSession(), persister, key );
final SharedSessionContractImplementor session = getLoadContext().getPersistenceContext().getSession(); final SessionFactoryImplementor factory = session.getFactory();
private SessionImplementor getSession() { return getPersistenceContext().getSession(); }
private SessionImplementor getSession() { return getPersistenceContext().getSession(); }
private boolean isCached(Serializable collectionKey, CollectionPersister persister) { if ( persister.hasCache() ) { CacheKey cacheKey = context.getSession().generateCacheKey( collectionKey, persister.getKeyType(), persister.getRole() ); return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null; } return false; } }
private boolean isCached(Serializable collectionKey, CollectionPersister persister) { if ( persister.hasCache() ) { CacheKey cacheKey = context.getSession().generateCacheKey( collectionKey, persister.getKeyType(), persister.getRole() ); return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null; } return false; } }
private boolean isCached(EntityKey entityKey, EntityPersister persister) { if ( persister.hasCache() ) { CacheKey key = context.getSession().generateCacheKey( entityKey.getIdentifier(), persister.getIdentifierType(), entityKey.getEntityName() ); return persister.getCacheAccessStrategy().get( key, context.getSession().getTimestamp() ) != null; } return false; }
private boolean isCached(EntityKey entityKey, EntityPersister persister) { if ( persister.hasCache() ) { CacheKey key = context.getSession().generateCacheKey( entityKey.getIdentifier(), persister.getIdentifierType(), entityKey.getEntityName() ); return persister.getCacheAccessStrategy().get( key, context.getSession().getTimestamp() ) != null; } return false; }
@SuppressWarnings( {"SimplifiableIfStatement"}) private boolean isUnequivocallyNonDirty(Object entity) { if ( getPersister().getInstrumentationMetadata().isInstrumented() ) { // the entity must be instrumented (otherwise we cant check dirty flag) and the dirty flag is false return ! getPersister().getInstrumentationMetadata().extractInterceptor( entity ).isDirty(); } final CustomEntityDirtinessStrategy customEntityDirtinessStrategy = persistenceContext.getSession().getFactory().getCustomEntityDirtinessStrategy(); if ( customEntityDirtinessStrategy.canDirtyCheck( entity, getPersister(), (Session) persistenceContext.getSession() ) ) { return ! customEntityDirtinessStrategy.isDirty( entity, getPersister(), (Session) persistenceContext.getSession() ); } return false; }