org.hibernate.type.AbstractSingleColumnStandardBasicType Java Examples

The following examples show how to use org.hibernate.type.AbstractSingleColumnStandardBasicType. 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 void resolveLob(final SingularAttributeSourceBasic attributeSource, SimpleValue value) {
	// Resolves whether the property is LOB based on the type attribute on the attribute property source.
	// Essentially this expects the type to map to a CLOB/NCLOB/BLOB sql type internally and compares.
	if ( !value.isLob() && value.getTypeName() != null ) {
		final TypeResolver typeResolver = attributeSource.getBuildingContext().getMetadataCollector().getTypeResolver();
		final BasicType basicType = typeResolver.basic( value.getTypeName() );
		if ( basicType instanceof AbstractSingleColumnStandardBasicType ) {
			if ( isLob( ( (AbstractSingleColumnStandardBasicType) basicType ).getSqlTypeDescriptor().getSqlType(), null ) ) {
				value.makeLob();
			}
		}
	}

	// If the prior check didn't set the lob flag, this will inspect the column sql-type attribute value and
	// if this maps to CLOB/NCLOB/BLOB then the value will be marked as lob.
	if ( !value.isLob() ) {
		for ( RelationalValueSource relationalValueSource : attributeSource.getRelationalValueSources() ) {
			if ( ColumnSource.class.isInstance( relationalValueSource ) ) {
				if ( isLob( null, ( (ColumnSource) relationalValueSource ).getSqlType() ) ) {
					value.makeLob();
				}
			}
		}
	}
}
 
Example #2
Source File: AbstractHeuristicUserType.java    From jadira with Apache License 2.0 5 votes vote down vote up
public void setParameterValues(Properties parameters) {
	
	@SuppressWarnings("unchecked")
	final AbstractSingleColumnStandardBasicType<? extends Object> heuristicType = (AbstractSingleColumnStandardBasicType<? extends Object>) new TypeResolver().heuristicType(identifierType.getName(), parameters);
	if (heuristicType == null) {
		throw new HibernateException("Unsupported identifier type " + identifierType.getName());
	}
	
	type = heuristicType;
	sqlTypes = new int[]{ type.sqlType() };
}
 
Example #3
Source File: AbstractHeuristicUserType.java    From jadira with Apache License 2.0 4 votes vote down vote up
protected AbstractSingleColumnStandardBasicType<?> getType() {
	return type;
}