public String getCacheRegionName() { return cacheRegionName == null ? getEntityName() : cacheRegionName; }
public NaturalIdDataCachingConfigImpl( RootClass rootEntityDescriptor, AccessType accessType) { super( accessType ); this.rootEntityDescriptor = rootEntityDescriptor; this.navigableRole = new NavigableRole( rootEntityDescriptor.getEntityName() ); // sucks that we need to do this here. persister does the same "calculation" this.mutable = hasAnyMutableNaturalIdProps(); }
params.setProperty( IdentifierGenerator.ENTITY_NAME, rootClass.getEntityName() ); params.setProperty( IdentifierGenerator.JPA_ENTITY_NAME, rootClass.getJpaEntityName() );
@Override public void validate(Mapping mapping) throws MappingException { super.validate( mapping ); if ( !getIdentifier().isValid( mapping ) ) { throw new MappingException( "identifier mapping has wrong number of columns: " + getEntityName() + " type: " + getIdentifier().getType().getName() ); } checkCompositeIdentifier(); }
@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; }
final NavigableRole rootEntityRole = new NavigableRole( model.getRootClass().getEntityName() ); final EntityDataAccess accessStrategy = sessionFactory.getCache().getEntityRegionAccess( rootEntityRole ); final NaturalIdDataAccess naturalIdAccessStrategy = sessionFactory.getCache().getNaturalIdCacheRegionAccessStrategy( rootEntityRole );
locator = new StandardGenerationContextLocator( rootClass.getEntityName() ); final CompositeNestedGeneratedValueGenerator generator = new CompositeNestedGeneratedValueGenerator( locator );
private static void bindDiscriminatorColumnToRootPersistentClass( RootClass rootClass, Ejb3DiscriminatorColumn discriminatorColumn, Map<String, Join> secondaryTables, PropertyHolder propertyHolder, MetadataBuildingContext context) { if ( rootClass.getDiscriminator() == null ) { if ( discriminatorColumn == null ) { throw new AssertionFailure( "discriminator column should have been built" ); } discriminatorColumn.setJoins( secondaryTables ); discriminatorColumn.setPropertyHolder( propertyHolder ); SimpleValue discriminatorColumnBinding = new SimpleValue( context, rootClass.getTable() ); rootClass.setDiscriminator( discriminatorColumnBinding ); discriminatorColumn.linkWithValue( discriminatorColumnBinding ); discriminatorColumnBinding.setTypeName( discriminatorColumn.getDiscriminatorTypeName() ); rootClass.setPolymorphic( true ); if ( LOG.isTraceEnabled() ) { LOG.tracev( "Setting discriminator for entity {0}", rootClass.getEntityName() ); } } }
rootName = persistentClass.getRootClass().getEntityName();
if ( !idValue.isTypeSpecified() ) { throw new MappingException( "must specify an identifier type: " + rootEntityDescriptor.getEntityName(), sourceDocument.getOrigin() );
log.debugf( "Mapping class: %s -> %s", rootEntityDescriptor.getEntityName(), primaryTable.getName() );
private static void bindDiscriminatorToPersistentClass( RootClass rootClass, Ejb3DiscriminatorColumn discriminatorColumn, Map<String, Join> secondaryTables, PropertyHolder propertyHolder ) { if ( rootClass.getDiscriminator() == null ) { if ( discriminatorColumn == null ) { throw new AssertionFailure( "discriminator column should have been built" ); } discriminatorColumn.setJoins( secondaryTables ); discriminatorColumn.setPropertyHolder( propertyHolder ); SimpleValue discrim = new SimpleValue( rootClass.getTable() ); rootClass.setDiscriminator( discrim ); discriminatorColumn.linkWithValue( discrim ); discrim.setTypeName( discriminatorColumn.getDiscriminatorTypeName() ); rootClass.setPolymorphic( true ); log.trace( "Setting discriminator for entity {}", rootClass.getEntityName() ); } }
public String getCacheRegionName() { return cacheRegionName==null ? getEntityName() : cacheRegionName; } public void setCacheRegionName(String cacheRegionName) {
public String getCacheRegionName() { return cacheRegionName==null ? getEntityName() : cacheRegionName; } public void setCacheRegionName(String cacheRegionName) {
public String getCacheRegionName() { return cacheRegionName==null ? getEntityName() : cacheRegionName; } public void setCacheRegionName(String cacheRegionName) {
public NaturalIdDataCachingConfigImpl( RootClass rootEntityDescriptor, AccessType accessType) { super( accessType ); this.rootEntityDescriptor = rootEntityDescriptor; this.navigableRole = new NavigableRole( rootEntityDescriptor.getEntityName() ); // sucks that we need to do this here. persister does the same "calculation" this.mutable = hasAnyMutableNaturalIdProps(); }
public void validate(Mapping mapping) throws MappingException { super.validate(mapping); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "identifier mapping has wrong number of columns: " + getEntityName() + " type: " + getIdentifier().getType().getName() ); } }
public void validate(Mapping mapping) throws MappingException { super.validate(mapping); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "identifier mapping has wrong number of columns: " + getEntityName() + " type: " + getIdentifier().getType().getName() ); } checkCompositeIdentifier(); }
@Override public void validate(Mapping mapping) throws MappingException { super.validate(mapping); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "identifier mapping has wrong number of columns: " + getEntityName() + " type: " + getIdentifier().getType().getName() ); } checkCompositeIdentifier(); }
@Override public void validate(Mapping mapping) throws MappingException { super.validate(mapping); if ( !getIdentifier().isValid(mapping) ) { throw new MappingException( "identifier mapping has wrong number of columns: " + getEntityName() + " type: " + getIdentifier().getType().getName() ); } checkCompositeIdentifier(); }