Search in sources :

Example 1 with BinaryType

use of org.hibernate.type.BinaryType in project hibernate-orm by hibernate.

the class SimpleValue method getType.

public Type getType() throws MappingException {
    if (type != null) {
        return type;
    }
    if (typeName == null) {
        throw new MappingException("No type name");
    }
    if (typeParameters != null && Boolean.valueOf(typeParameters.getProperty(DynamicParameterizedType.IS_DYNAMIC)) && typeParameters.get(DynamicParameterizedType.PARAMETER_TYPE) == null) {
        createParameterImpl();
    }
    Type result = metadata.getTypeResolver().heuristicType(typeName, typeParameters);
    // instead of BinaryType (HHH-10413)
    if (isVersion && BinaryType.class.isInstance(result)) {
        log.debug("version is BinaryType; changing to RowVersionType");
        result = RowVersionType.INSTANCE;
    }
    if (result == null) {
        String msg = "Could not determine type for: " + typeName;
        if (table != null) {
            msg += ", at table: " + table.getName();
        }
        if (columns != null && columns.size() > 0) {
            msg += ", for columns: " + columns;
        }
        throw new MappingException(msg);
    }
    return result;
}
Also used : BinaryType(org.hibernate.type.BinaryType) DynamicParameterizedType(org.hibernate.usertype.DynamicParameterizedType) RowVersionType(org.hibernate.type.RowVersionType) Type(org.hibernate.type.Type) BinaryType(org.hibernate.type.BinaryType) MappingException(org.hibernate.MappingException)

Aggregations

MappingException (org.hibernate.MappingException)1 BinaryType (org.hibernate.type.BinaryType)1 RowVersionType (org.hibernate.type.RowVersionType)1 Type (org.hibernate.type.Type)1 DynamicParameterizedType (org.hibernate.usertype.DynamicParameterizedType)1