Add support for composite user types in Hibernate
See original GitHub issueCurrently it is not possible to query composite properties of an entity. However, Hibernate does support such constructions through the CompositeUserType
interface and @Type
annotation.
In our implementation of Java Money using Jadira we encountered such a composite type; Money
, which consists of the properties amount
and currency
. We would like to be able to query it correctly using Blaze.
Currently, attempting to query a composite type throws
java.lang.IllegalArgumentException: The join path [product.price.amount] has a non joinable part [price.amount]
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Custom Types in Hibernate - Baeldung
Learn how to use custom Java classes to extend basic type mapping in Hibernate.
Read more >Hibernate list of custom composite type - Stack Overflow
public class PersistentLocalIntervalAsTime implements CompositeUserType, Serializable { public String[] getPropertyNames() {return new String[]{ ...
Read more >Hibernate ORM 6.1.6.Final User Guide - Red Hat on GitHub
A composite user type needs an embeddable mapper class, which represents the embeddable mapping structure of the type i.e. the way the type...
Read more >The Ultimate Guide on Composite IDs in JPA Entities
The first approach – is to use the @Embeddable class, which contains all fields representing a composite key. We should create a field...
Read more >QueryDsl and hibernate CompositeUserType - Google Groups
Hi,. In our project, we have a Money class and we use a hibernate usertype to persist it to the database. When I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I recently started working on this issue (https://github.com/jwgmeligmeyling/blaze-persistence/commit/6c2ca771c34c5c3f43cb903921d8f861906a1f03). Basically we need to treat Composite types as embeddables. Making this change in our metamodel is relatively easy. However, a lot of code still uses the plain JPA metamodel. In order to support composite user types fully, we need to change these occurrences of JPA metamodel access to that they use BP’s internal metamodel instead. This is a change we’re willing to make, because it’s not only required for dereferencing composite user types but its also relevant for dereferencing JSON properties.
It is actually a separate project since the beginning. The only reason for needing it as separate project is for modules like entity-view-impl etc. which do parsing at boot time, but I think it should be fine to instead depend on core-impl. I don’t expect a different implementation of Blaze-Persistence anyway 😆