question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for composite user types in Hibernate

See original GitHub issue

Currently 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:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jwgmeligmeylingcommented, May 8, 2020

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.

0reactions
beikovcommented, Oct 13, 2021

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 😆

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found