Java Code Examples for org.hibernate.mapping.SimpleValue#makeNationalized()

The following examples show how to use org.hibernate.mapping.SimpleValue#makeNationalized() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelBinder.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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 );
	}
}
 
Example 2
Source File: SimpleValueBinder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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;
	}
 
Example 3
Source File: ModelBinder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
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 );
}