}
private static void bindPersistentClassCommonValues(Element node, PersistentClass entity,
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
// DISCRIMINATOR
Attribute discriminatorNode = node.attribute( "discriminator-value" );
entity.setDiscriminatorValue( ( discriminatorNode == null )
? entity.getEntityName()
: discriminatorNode.getValue() );
// DYNAMIC UPDATE
Attribute dynamicNode = node.attribute( "dynamic-update" );
entity.setDynamicUpdate(
dynamicNode != null && "true".equals( dynamicNode.getValue() )
);
// DYNAMIC INSERT
Attribute insertNode = node.attribute( "dynamic-insert" );
entity.setDynamicInsert(
insertNode != null && "true".equals( insertNode.getValue() )
);
// IMPORT
mappings.addImport( entity.getEntityName(), entity.getEntityName() );
if ( mappings.isAutoImport() && entity.getEntityName().indexOf( '.' ) > 0 ) {
mappings.addImport(
entity.getEntityName(),
StringHelper.unqualify( entity.getEntityName() )
);
}
// BATCH SIZE
Attribute batchNode = node.attribute( "batch-size" );
if ( batchNode != null ) entity.setBatchSize( Integer.parseInt( batchNode.getValue() ) );
// SELECT BEFORE UPDATE
Attribute sbuNode = node.attribute( "select-before-update" );
if ( sbuNode != null ) entity.setSelectBeforeUpdate( "true".equals( sbuNode.getValue() ) );
// OPTIMISTIC LOCK MODE
Attribute olNode = node.attribute( "optimistic-lock" );
entity.setOptimisticLockMode( getOptimisticLockMode( olNode ) );
entity.setMetaAttributes( getMetas( node, inheritedMetas ) );
// PERSISTER
Attribute persisterNode = node.attribute( "persister" );
if ( persisterNode != null ) {
try {
entity.setEntityPersisterClass( ReflectHelper.classForName( persisterNode
.getValue() ) );
}
catch (ClassNotFoundException cnfe) {
throw new MappingException( "Could not find persister class: "
+ persisterNode.getValue() );
}
}
// CUSTOM SQL
handleCustomSQL( node, entity );
Iterator tables = node.elementIterator( "synchronize" );
while ( tables.hasNext() ) {
entity.addSynchronizedTable( ( (Element) tables.next() ).attributeValue( "table" ) );
}
Attribute abstractNode = node.attribute( "abstract" );
Boolean isAbstract = abstractNode == null
? null
: "true".equals( abstractNode.getValue() )
? Boolean.TRUE
: "false".equals( abstractNode.getValue() )
? Boolean.FALSE
: null;
entity.setAbstract( isAbstract );
}