public RootClass getRootClass() { return getSuperclass().getRootClass(); }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
public boolean needsIdTable(PersistentClass entityBinding) { // need id table if the entity has secondary tables (joins) if ( entityBinding.getJoinClosureSpan() > 0 ) { return true; } // need an id table if the entity is part of either a JOINED or UNION inheritance // hierarchy. We do not allow inheritance strategy mixing, so work on that assumption // here... final RootClass rootEntityBinding = entityBinding.getRootClass(); final Iterator itr = rootEntityBinding.getSubclassIterator(); if ( itr.hasNext() ) { final Subclass subclassEntityBinding = (Subclass) itr.next(); if ( subclassEntityBinding instanceof JoinedSubclass || subclassEntityBinding instanceof UnionSubclass ) { return true; } } return false; }
@SuppressWarnings("UnusedReturnValue") public Builder addEntityConfig(PersistentClass bootEntityDescriptor, AccessType accessType) { if ( entityConfigsByRootName == null ) { entityConfigsByRootName = new HashMap<>(); } // todo (5.3) : this is another place where having `BootstrapContext` / `TypeConfiguration` helps // would allow us to delay the attempt to resolve the comparator (usual timing issues wrt Type resolution) final NavigableRole rootEntityName = new NavigableRole( bootEntityDescriptor.getRootClass().getEntityName() ); final EntityDataCachingConfigImpl entityDataCachingConfig = entityConfigsByRootName.computeIfAbsent( rootEntityName, x -> new EntityDataCachingConfigImpl( rootEntityName, bootEntityDescriptor.isVersioned() ? (Supplier<Comparator>) () -> ( (VersionType) bootEntityDescriptor.getVersion().getType() ).getComparator() : null, bootEntityDescriptor.isMutable(), accessType ) ); if ( bootEntityDescriptor == bootEntityDescriptor.getRootClass() ) { entityDataCachingConfig.addCachedType( rootEntityName ); } else { entityDataCachingConfig.addCachedType( new NavigableRole( bootEntityDescriptor.getEntityName() ) ); } return this; }
regionConfigBuilders.computeIfAbsent( bootEntityDescriptor.getRootClass().getCacheRegionName(), DomainDataRegionConfigImpl.Builder::new ) .addEntityConfig( bootEntityDescriptor, accessType );
final NavigableRole rootEntityRole = new NavigableRole( model.getRootClass().getEntityName() ); final EntityDataAccess accessStrategy = sessionFactory.getCache().getEntityRegionAccess( rootEntityRole ); final NaturalIdDataAccess naturalIdAccessStrategy = sessionFactory.getCache().getNaturalIdCacheRegionAccessStrategy( rootEntityRole );
this.canReadFromCache = determineCanReadFromCache( persistentClass, cacheAccessStrategy ); this.cacheAccessStrategy = cacheAccessStrategy; this.isLazyPropertiesCacheable = persistentClass.getRootClass().isLazyPropertiesCacheable(); this.naturalIdRegionAccessStrategy = naturalIdRegionAccessStrategy;
if ( persistentClass.getRootClass().isCached() ) { if ( ! names.add( persistentClass.getRootClass().getCacheRegionName() ) ) { continue; createCache( cacheManager, persistentClass.getRootClass().getCacheRegionName(), prefixRegions );
rootName = persistentClass.getRootClass().getEntityName();
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
/** * @deprecated since 6.0, use {@link EntityMappingHierarchy#getRootType()}. */ @Deprecated public RootClass getRootClass() { return getSuperclass().getRootClass(); }
public RootClass getRootClass() { return getSuperclass().getRootClass(); }
public RootClass getRootClass() { return getSuperclass().getRootClass(); }
public RootClass getRootClass() { return getSuperclass().getRootClass(); }
public RootClass getRootClass() { return getSuperclass().getRootClass(); }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
public boolean hasNaturalId() { Iterator props = getRootClass().getPropertyIterator(); while ( props.hasNext() ) { if ( ( (Property) props.next() ).isNaturalIdentifier() ) { return true; } } return false; }
/** * @param clazz persistent class. * @return "String name, int number, ..." for a property list, usable for method declarations. * <p/> * TODO: handle this in a template ? */ public String asNaturalIdParameterList(PersistentClass clazz) { Iterator<?> fields = clazz.getRootClass().getPropertyIterator(); StringBuffer buf = new StringBuffer(); while ( fields.hasNext() ) { Property field = (Property) fields.next(); if ( field.isNaturalIdentifier() ) { buf.append( getJavaTypeName( field, false ) ) .append( " " ) .append( field.getName() ) .append( ", " ); } } return buf.substring( 0, buf.length() - 2 ); }
final JoinedSubclass jsc = ( JoinedSubclass ) persistentClass; if ( persistentClass.getEntityPersisterClass() == null ) { persistentClass.getRootClass().setEntityPersisterClass( JoinedSubclassEntityPersister.class ); if ( inheritanceState.hasParents() ) { if ( persistentClass.getEntityPersisterClass() == null ) { persistentClass.getRootClass().setEntityPersisterClass( SingleTableEntityPersister.class ); if ( inheritanceState.hasParents() ) { if ( persistentClass.getEntityPersisterClass() == null ) { persistentClass.getRootClass().setEntityPersisterClass( UnionSubclassEntityPersister.class );