下面列出了org.hibernate.mapping.SimpleValue#makeNationalized ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void bindSimpleValueType(
MappingDocument mappingDocument,
HibernateTypeSource typeSource,
SimpleValue simpleValue) {
if ( mappingDocument.getBuildingOptions().useNationalizedCharacterData() ) {
simpleValue.makeNationalized();
}
final TypeResolution typeResolution = resolveType( mappingDocument, typeSource );
if ( typeResolution == null ) {
// no explicit type info was found
return;
}
if ( CollectionHelper.isNotEmpty( typeResolution.parameters ) ) {
simpleValue.setTypeParameters( typeResolution.parameters );
}
if ( typeResolution.typeName != null ) {
simpleValue.setTypeName( typeResolution.typeName );
}
}
public SimpleValue make() {
validate();
LOG.debugf( "building SimpleValue for %s", propertyName );
if ( table == null ) {
table = columns[0].getTable();
}
simpleValue = new SimpleValue( buildingContext, table );
if ( isVersion ) {
simpleValue.makeVersion();
}
if ( isNationalized ) {
simpleValue.makeNationalized();
}
if ( isLob ) {
simpleValue.makeLob();
}
linkWithValue();
boolean isInSecondPass = buildingContext.getMetadataCollector().isInSecondPass();
if ( !isInSecondPass ) {
//Defer this to the second pass
buildingContext.getMetadataCollector().addSecondPass( new SetSimpleValueTypeSecondPass( this ) );
}
else {
//We are already in second pass
fillSimpleValue();
}
return simpleValue;
}
private void bindJoinedSubclassEntity(
JoinedSubclassEntitySourceImpl entitySource,
JoinedSubclass entityDescriptor) {
MappingDocument mappingDocument = entitySource.sourceMappingDocument();
bindBasicEntityValues(
mappingDocument,
entitySource,
entityDescriptor
);
final Table primaryTable = bindEntityTableSpecification(
mappingDocument,
entitySource.getPrimaryTable(),
null,
entitySource,
entityDescriptor
);
entityDescriptor.setTable( primaryTable );
if ( log.isDebugEnabled() ) {
log.debugf( "Mapping joined-subclass: %s -> %s", entityDescriptor.getEntityName(), primaryTable.getName() );
}
// KEY
final SimpleValue keyBinding = new DependantValue(
mappingDocument,
primaryTable,
entityDescriptor.getIdentifier()
);
if ( mappingDocument.getBuildingOptions().useNationalizedCharacterData() ) {
keyBinding.makeNationalized();
}
entityDescriptor.setKey( keyBinding );
keyBinding.setCascadeDeleteEnabled( entitySource.isCascadeDeleteEnabled() );
relationalObjectBinder.bindColumns(
mappingDocument,
entitySource.getPrimaryKeyColumnSources(),
keyBinding,
false,
new RelationalObjectBinder.ColumnNamingDelegate() {
int count = 0;
@Override
public Identifier determineImplicitName(LocalMetadataBuildingContext context) {
final Column column = primaryTable.getPrimaryKey().getColumn( count++ );
return database.toIdentifier( column.getQuotedName() );
}
}
);
keyBinding.setForeignKeyName( entitySource.getExplicitForeignKeyName() );
// model.getKey().setType( new Type( model.getIdentifier() ) );
entityDescriptor.createPrimaryKey();
entityDescriptor.createForeignKey();
// todo : tooling hints
bindAllEntityAttributes(
entitySource.sourceMappingDocument(),
entitySource,
entityDescriptor
);
bindJoinedSubclassEntities( entitySource, entityDescriptor );
}