return entityBinding;
}
private EntityBinding buildBasicEntityBinding(EntitySource entitySource, EntityBinding superEntityBinding) {
final EntityBinding entityBinding = new EntityBinding();
entityBinding.setSuperEntityBinding( superEntityBinding );
entityBinding.setInheritanceType( currentInheritanceType );
entityBinding.setEntityMode( currentHierarchyEntityMode );
final String entityName = entitySource.getEntityName();
final String className = currentHierarchyEntityMode == EntityMode.POJO ? entitySource.getClassName() : null;
final Entity entity = new Entity(
entityName,
className,
currentBindingContext.makeClassReference( className ),
null
);
entityBinding.setEntity( entity );
entityBinding.setJpaEntityName( entitySource.getJpaEntityName() );
if ( entityBinding.getEntityMode() == EntityMode.POJO ) {
final String proxy = entitySource.getProxy();
if ( proxy != null ) {
entityBinding.setProxyInterfaceType(
currentBindingContext.makeClassReference(
currentBindingContext.qualifyClassName( proxy )
)
);
entityBinding.setLazy( true );
}
else if ( entitySource.isLazy() ) {
entityBinding.setProxyInterfaceType( entityBinding.getEntity().getClassReferenceUnresolved() );
entityBinding.setLazy( true );
}
}
else {
entityBinding.setProxyInterfaceType( null );
entityBinding.setLazy( entitySource.isLazy() );
}
final String customTuplizerClassName = entitySource.getCustomTuplizerClassName();
if ( customTuplizerClassName != null ) {
entityBinding.setCustomEntityTuplizerClass( currentBindingContext.<EntityTuplizer>locateClassByName( customTuplizerClassName ) );
}
final String customPersisterClassName = entitySource.getCustomPersisterClassName();
if ( customPersisterClassName != null ) {
entityBinding.setCustomEntityPersisterClass( currentBindingContext.<EntityPersister>locateClassByName( customPersisterClassName ) );
}
entityBinding.setMetaAttributeContext( buildMetaAttributeContext( entitySource ) );
entityBinding.setDynamicUpdate( entitySource.isDynamicUpdate() );
entityBinding.setDynamicInsert( entitySource.isDynamicInsert() );
entityBinding.setBatchSize( entitySource.getBatchSize() );
entityBinding.setSelectBeforeUpdate( entitySource.isSelectBeforeUpdate() );
entityBinding.setAbstract( entitySource.isAbstract() );
entityBinding.setCustomLoaderName( entitySource.getCustomLoaderName() );
entityBinding.setCustomInsert( entitySource.getCustomSqlInsert() );
entityBinding.setCustomUpdate( entitySource.getCustomSqlUpdate() );
entityBinding.setCustomDelete( entitySource.getCustomSqlDelete() );
if ( entitySource.getSynchronizedTableNames() != null ) {
entityBinding.addSynchronizedTableNames( entitySource.getSynchronizedTableNames() );
}
return entityBinding;
}