Cannot use AttributeConverter with spatial types

Description

Given a domain type Foo and an AttributeConverter<Foo, Point<G2D>>, Hibernate fails to infer the database type for the field from the converter.

Test case: https://github.com/heruan/hibernate-testcase/tree/spatial-converter

Environment

None

Activity

Show:
Steve Ebersole
March 22, 2018, 12:58 AM

Any luck trying the patch workaround?

Giovanni Lovato
March 22, 2018, 9:01 AM

Thank you for the thorough explanation Steve! All is much cleared now. I'm trying to patch as you suggested, but I admit I'm not that into Hibernate's internals; for example, JdbcTypeJavaClassMappings maps Class to Integer and vice versa, but in Types there is no value for GEOMETRY: how do I know which value to use?

Steve Ebersole
March 23, 2018, 3:59 AM

but in Types there is no value for GEOMETRY

You mean in java.sql.Types? Why would that matter? They are just ints. You need to find the properly type code for your database for its geometry type.

Steve Ebersole
March 29, 2018, 2:22 AM

The preliminary work (BootstrapContext and TypeConfiguration) are in place now on 5.3 to address this...

Steve Ebersole
March 30, 2018, 8:11 PM

If hibernate-spatial is on classpath and one of its Dialects are used, then this will JustWork. However, if hibernate-spatial is not on classpath or one of its Dialects is not used, then you will have to register the proper JavaTypeDescriptor yourself.

Assignee

Steve Ebersole

Reporter

Giovanni Lovato

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure