Search in sources :

Example 1 with TypeConfigurationAware

use of org.hibernate.type.spi.TypeConfigurationAware in project hibernate-orm by hibernate.

the class TypeFactory method custom.

public CustomType custom(Class<UserType> typeClass, Properties parameters) {
    try {
        UserType userType = typeClass.newInstance();
        if (TypeConfigurationAware.class.isInstance(userType)) {
            ((TypeConfigurationAware) userType).setTypeConfiguration(typeConfiguration);
        }
        injectParameters(userType, parameters);
        return new CustomType(userType);
    } catch (Exception e) {
        throw new MappingException("Unable to instantiate custom type: " + typeClass.getName(), e);
    }
}
Also used : TypeConfigurationAware(org.hibernate.type.spi.TypeConfigurationAware) CompositeUserType(org.hibernate.usertype.CompositeUserType) UserType(org.hibernate.usertype.UserType) MappingException(org.hibernate.MappingException) MappingException(org.hibernate.MappingException)

Aggregations

MappingException (org.hibernate.MappingException)1 TypeConfigurationAware (org.hibernate.type.spi.TypeConfigurationAware)1 CompositeUserType (org.hibernate.usertype.CompositeUserType)1 UserType (org.hibernate.usertype.UserType)1