-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Use case:
Jooq 3.16 brings new useful Spacial support which brings org.jooq.Geometry class which responsibility is:
- to hold the spacial data
- to provide ORM mapping (using special Class) between database types (per each RDBMS) and Java object model.
It looks like automatic conversion is (currently) supported only in commercial versions of Jooq so additional development is needed to implement GeometryBinding for your specific RDBMS. This is simply the decision for authors to give us the solution for non-commercial use.
Another issue is that org.jooq.Geometry accepts spacial data only as String therefore transformation between Strings and byte arrays is painful and non performant. For example if you use own implementation of https://github.com/simplegeo/jts you end up with having complicated mapping from and to persistence as presented in workarounds.
Possible solution you'd like to see:
I don't have insights at the moment into how this is handled by other RDBMS but I believe it would be best to change org.jooq.Geometry class in a way to contain byte array instead of String.
It would be very nice to have a possibility to include some spacial transformations into the org.jooq.Geometry itself e.g. org.jooq.Geometry.createPoint(longitude, latitude) which outputs WKB data in byte array which is then stored into RDBMS without needing external libraries for conversion.
Possible workarounds:
1. I need to create JTS object in my business logic since I have all the support (spacial operations) in the provided library.
2. I set the value if type JTS into the Record and execute insert to the database
3. Geometry binding needs to output WKB which has type of byte[]
4. Array of bytes must be transformed to `org.jooq.Geometry` String using base64 encoding
5. Geometry Binding needs to decode base64 encoded string back to byte array and pass it down to RDBMS as BINARY.
Versions:
- jOOQ: 3.16
- Java: 11
- Database (include vendor): MariaDB 10.5