Nick Williams commented on Bug HHH-8111

I don't really understand a lot about what's going on, but I think I know what needs to change. Lines 383-396 of org.hibernate.mapping.SimpleValue are as follows:

// AttributeConverter works totally in memory, meaning it converts between one Java representation (the entity
// attribute representation) and another (the value bound into JDBC statements or extracted from results).
// However, the Hibernate Type system operates at the lower level of actually dealing with those JDBC objects.
// So even though we have an AttributeConverter, we still need to "fill out" the rest of the BasicType
// data.  For the JavaTypeDescriptor portion we simply resolve the "entity attribute representation" part of
// the AttributeConverter to resolve the corresponding descriptor.  For the SqlTypeDescriptor portion we use the
// "database column representation" part of the AttributeConverter to resolve the "recommended" JDBC type-code
// and use that type-code to resolve the SqlTypeDescriptor to use.
final Class entityAttributeJavaType = jpaAttributeConverterDefinition.getEntityAttributeType();
final Class databaseColumnJavaType = jpaAttributeConverterDefinition.getDatabaseColumnType();
final int jdbcTypeCode = JdbcTypeJavaClassMappings.INSTANCE.determineJdbcTypeCodeForJavaClass( databaseColumnJavaType );

final JavaTypeDescriptor javaTypeDescriptor = JavaTypeDescriptorRegistry.INSTANCE.getDescriptor( entityAttributeJavaType );
final SqlTypeDescriptor sqlTypeDescriptor = SqlTypeDescriptorRegistry.INSTANCE.getDescriptor( jdbcTypeCode );

In this case, JavaTypeDescriptorRegistry.INSTANCE.getDescriptor will return a value based on the field type, not based on the type that the converter converts it to. It SHOULD be base on the type the converter converts it to:

final JavaTypeDescriptor javaTypeDescriptor = JavaTypeDescriptorRegistry.INSTANCE.getDescriptor( databaseColumnJavaType );

Now this will return the correct value. In theory. But, like I said, I could be missing something.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira