org.hibernate.type.TypeResolver Java Examples

The following examples show how to use org.hibernate.type.TypeResolver. 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: TypeConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public TypeConfiguration() {
	this.scope = new Scope();
	this.javaTypeDescriptorRegistry = new JavaTypeDescriptorRegistry( this );
	this.sqlTypeDescriptorRegistry = new SqlTypeDescriptorRegistry( this );

	this.basicTypeRegistry = new BasicTypeRegistry();
	this.typeFactory = new TypeFactory( this );
	this.typeResolver = new TypeResolver( this, typeFactory );

	TypeConfigurationRegistry.INSTANCE.registerTypeConfiguration( this );
}
 
Example #4
Source File: IdsClauseBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @deprecated Use {{@link IdsClauseBuilder#IdsClauseBuilder(Dialect, Type, TypeConfiguration, String[], List)}} instead.
 */
@Deprecated
protected IdsClauseBuilder(
		Dialect dialect,
		Type identifierType,
		TypeResolver typeResolver,
		String[] columns,
		List<Object[]> ids) {
	this.dialect = dialect;
	this.identifierType = identifierType;
	this.typeResolver = typeResolver;
	this.columns = columns;
	this.ids = ids;
}
 
Example #5
Source File: InlineIdsOrClauseBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public InlineIdsOrClauseBuilder(
		Dialect dialect, Type identifierType, TypeResolver typeResolver, String[] columns, List<Object[]> ids) {
	super( dialect, identifierType, typeResolver, columns, ids );
}
 
Example #6
Source File: SessionFactoryWrapper.java    From lemon with Apache License 2.0 4 votes vote down vote up
public TypeResolver getTypeResolver() {
    return sessionFactoryImplementor.getTypeResolver();
}
 
Example #7
Source File: HibernateQuery.java    From gorm-hibernate5 with Apache License 2.0 4 votes vote down vote up
@Deprecated
protected TypeResolver getTypeResolver(SessionFactory sessionFactory) {
    return ((SessionFactoryImplementor) sessionFactory).getTypeResolver();
}
 
Example #8
Source File: InlineIdsSubSelectValuesListBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public InlineIdsSubSelectValuesListBuilder(
		Dialect dialect, Type identifierType, TypeResolver typeResolver, String[] columns, List<Object[]> ids) {
	super( dialect, identifierType, typeResolver, columns, ids );
}
 
Example #9
Source File: InlineIdsInClauseBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public InlineIdsInClauseBuilder(
		Dialect dialect, Type identifierType, TypeResolver typeResolver, String[] columns, List<Object[]> ids) {
	super( dialect, identifierType, typeResolver, columns, ids );
	this.chunkLimit = dialect.getInExpressionCountLimit();
}
 
Example #10
Source File: TypeLocatorImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public TypeLocatorImpl(TypeResolver typeResolver) {
	this.typeResolver = typeResolver;
}
 
Example #11
Source File: MetadataImpl.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
public TypeResolver getTypeResolver() {
	return bootstrapContext.getTypeConfiguration().getTypeResolver();
}
 
Example #12
Source File: SessionFactoryImplementor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.2) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
TypeResolver getTypeResolver();
 
Example #13
Source File: InFlightMetadataCollectorImpl.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
public TypeResolver getTypeResolver() {
	return bootstrapContext.getTypeConfiguration().getTypeResolver();
}
 
Example #14
Source File: IdsClauseBuilder.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
public TypeResolver getTypeResolver() {
	return typeResolver;
}
 
Example #15
Source File: AbstractDelegatingMetadata.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
public TypeResolver getTypeResolver() {
	return delegate.getTypeResolver();
}
 
Example #16
Source File: MetadataImplementor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
TypeResolver getTypeResolver();
 
Example #17
Source File: TypeConfiguration.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Temporarily needed to support deprecations
 *
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
public TypeResolver getTypeResolver(){
	return typeResolver;
}
 
Example #18
Source File: SessionFactoryImpl.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
public TypeResolver getTypeResolver() {
	return metamodel.getTypeConfiguration().getTypeResolver();
}
 
Example #19
Source File: SessionFactoryDelegatingImpl.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the {@link Type} resolver associated with this factory.
 *
 * @return The type resolver
 *
 * @deprecated (since 5.3) No replacement, access to and handling of Types will be much different in 6.0
 */
@Deprecated
public TypeResolver getTypeResolver() {
	return delegate.getTypeResolver();
}
 
Example #20
Source File: AbstractHibernateQuery.java    From gorm-hibernate5 with Apache License 2.0 votes vote down vote up
protected abstract TypeResolver getTypeResolver(SessionFactory sessionFactory);