org.hibernate.persister.spi.PersisterCreationContext Java Examples

The following examples show how to use org.hibernate.persister.spi.PersisterCreationContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PersisterFactoryImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
@SuppressWarnings( {"unchecked"})
public EntityPersister createEntityPersister(
		PersistentClass entityBinding,
		EntityDataAccess entityCacheAccessStrategy,
		NaturalIdDataAccess naturalIdCacheAccessStrategy,
		PersisterCreationContext creationContext) throws HibernateException {
	// If the metadata for the entity specified an explicit persister class, use it...
	Class<? extends EntityPersister> persisterClass = entityBinding.getEntityPersisterClass();
	if ( persisterClass == null ) {
		// Otherwise, use the persister class indicated by the PersisterClassResolver service
		persisterClass = serviceRegistry.getService( PersisterClassResolver.class ).getEntityPersisterClass( entityBinding );
	}

	return createEntityPersister(
			persisterClass,
			entityBinding,
			entityCacheAccessStrategy,
			naturalIdCacheAccessStrategy,
			creationContext
	);
}
 
Example #2
Source File: ReactiveSingleTableEntityPersister.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ReactiveSingleTableEntityPersister(
		PersistentClass persistentClass,
		EntityDataAccess cacheAccessStrategy,
		NaturalIdDataAccess naturalIdRegionAccessStrategy,
		PersisterCreationContext creationContext) throws HibernateException {
	super( persistentClass, cacheAccessStrategy, naturalIdRegionAccessStrategy, creationContext );
}
 
Example #3
Source File: ReactiveJoinedSubclassEntityPersister.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ReactiveJoinedSubclassEntityPersister(
		PersistentClass persistentClass,
		EntityDataAccess cacheAccessStrategy,
		NaturalIdDataAccess naturalIdRegionAccessStrategy,
		PersisterCreationContext creationContext) throws HibernateException {
	super( persistentClass, cacheAccessStrategy, naturalIdRegionAccessStrategy, creationContext );
}
 
Example #4
Source File: ReactiveUnionSubclassEntityPersister.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ReactiveUnionSubclassEntityPersister(
		PersistentClass persistentClass,
		EntityDataAccess cacheAccessStrategy,
		NaturalIdDataAccess naturalIdRegionAccessStrategy,
		PersisterCreationContext creationContext) throws HibernateException {
	super( persistentClass, cacheAccessStrategy, naturalIdRegionAccessStrategy, creationContext );
}
 
Example #5
Source File: AbstractEntityPersister.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("RedundantIfStatement")
private boolean determineWhetherToInvalidateCache(
		PersistentClass persistentClass,
		PersisterCreationContext creationContext) {
	if ( hasFormulaProperties() ) {
		return true;
	}

	if ( isVersioned() ) {
		return false;
	}

	if ( entityMetamodel.isDynamicUpdate() ) {
		return false;
	}

	// We need to check whether the user may have circumvented this logic (JPA TCK)
	final boolean complianceEnabled = creationContext.getSessionFactory()
			.getSessionFactoryOptions()
			.getJpaCompliance()
			.isJpaCacheComplianceEnabled();
	if ( complianceEnabled ) {
		// The JPA TCK (inadvertently, but still...) requires that we cache
		// entities with secondary tables even though Hibernate historically
		// invalidated them
		return false;
	}

	if ( persistentClass.getJoinClosureSpan() >= 1 ) {
		// todo : this should really consider optionality of the secondary tables in count
		//		non-optional tables do not cause this bypass
		return true;
	}

	return false;
}
 
Example #6
Source File: PersisterFactoryImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings( {"unchecked"})
public CollectionPersister createCollectionPersister(
		Collection collectionBinding,
		CollectionDataAccess cacheAccessStrategy,
		PersisterCreationContext creationContext) throws HibernateException {
	// If the metadata for the collection specified an explicit persister class, use it
	Class<? extends CollectionPersister> persisterClass = collectionBinding.getCollectionPersisterClass();
	if ( persisterClass == null ) {
		// Otherwise, use the persister class indicated by the PersisterClassResolver service
		persisterClass = serviceRegistry.getService( PersisterClassResolver.class )
				.getCollectionPersisterClass( collectionBinding );
	}
	return createCollectionPersister( persisterClass, collectionBinding, cacheAccessStrategy, creationContext );
}
 
Example #7
Source File: OneToManyPersister.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public OneToManyPersister(
		Collection collectionBinding,
		CollectionDataAccess cacheAccessStrategy,
		PersisterCreationContext creationContext) throws MappingException, CacheException {
	super( collectionBinding, cacheAccessStrategy, creationContext );
	cascadeDeleteEnabled = collectionBinding.getKey().isCascadeDeleteEnabled()
			&& creationContext.getSessionFactory().getDialect().supportsCascadeDelete();
	keyIsNullable = collectionBinding.getKey().isNullable();
	keyIsUpdateable = collectionBinding.getKey().isUpdateable();
}
 
Example #8
Source File: ReactiveOneToManyPersister.java    From hibernate-reactive with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ReactiveOneToManyPersister(Collection collectionBinding, CollectionDataAccess cacheAccessStrategy, PersisterCreationContext creationContext) throws MappingException, CacheException {
	super( collectionBinding, cacheAccessStrategy, creationContext );
}
 
Example #9
Source File: BasicCollectionPersister.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public BasicCollectionPersister(
		Collection collectionBinding,
		CollectionDataAccess cacheAccessStrategy,
		PersisterCreationContext creationContext) throws MappingException, CacheException {
	super( collectionBinding, cacheAccessStrategy, creationContext );
}