本文整理汇总了Java中org.hibernate.mapping.RootClass.setPolymorphic方法的典型用法代码示例。如果您正苦于以下问题:Java RootClass.setPolymorphic方法的具体用法?Java RootClass.setPolymorphic怎么用?Java RootClass.setPolymorphic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.mapping.RootClass
的用法示例。
在下文中一共展示了RootClass.setPolymorphic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindDiscriminatorProperty
import org.hibernate.mapping.RootClass; //导入方法依赖的package包/类
private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode,
Mappings mappings) {
SimpleValue discrim = new SimpleValue( mappings, table );
entity.setDiscriminator( discrim );
bindSimpleValue(
subnode,
discrim,
false,
RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME,
mappings
);
if ( !discrim.isTypeSpecified() ) {
discrim.setTypeName( "string" );
// ( (Column) discrim.getColumnIterator().next() ).setType(type);
}
entity.setPolymorphic( true );
final String explicitForceValue = subnode.attributeValue( "force" );
boolean forceDiscriminatorInSelects = explicitForceValue == null
? mappings.forceDiscriminatorInSelectsByDefault()
: "true".equals( explicitForceValue );
entity.setForceDiscriminator( forceDiscriminatorInSelects );
if ( "false".equals( subnode.attributeValue( "insert" ) ) ) {
entity.setDiscriminatorInsertable( false );
}
}
示例2: bindDiscriminatorColumnToRootPersistentClass
import org.hibernate.mapping.RootClass; //导入方法依赖的package包/类
private static void bindDiscriminatorColumnToRootPersistentClass(
RootClass rootClass,
Ejb3DiscriminatorColumn discriminatorColumn,
Map<String, Join> secondaryTables,
PropertyHolder propertyHolder,
Mappings mappings) {
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( mappings, 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() );
}
}
}
示例3: bindDiscriminatorProperty
import org.hibernate.mapping.RootClass; //导入方法依赖的package包/类
private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode,
Mappings mappings) {
SimpleValue discrim = new SimpleValue( table );
entity.setDiscriminator( discrim );
bindSimpleValue(
subnode,
discrim,
false,
RootClass.DEFAULT_DISCRIMINATOR_COLUMN_NAME,
mappings
);
if ( !discrim.isTypeSpecified() ) {
discrim.setTypeName( "string" );
// ( (Column) discrim.getColumnIterator().next() ).setType(type);
}
entity.setPolymorphic( true );
if ( "true".equals( subnode.attributeValue( "force" ) ) )
entity.setForceDiscriminator( true );
if ( "false".equals( subnode.attributeValue( "insert" ) ) )
entity.setDiscriminatorInsertable( false );
}