JPA 2.1 introduced type converters. I have found examples of converters based on a single entity attribute.
Is it possible to create a type converter based on multiple entity attributes?
Are there some examples?
JPA 2.2 doesn't support this feature.
If you are using Hibernate, then you can simply use a Hibernate CompositeUserType
.
Hibernate gives you the flexibility of mapping one or more SQL types to specific Domain Model subtypes (e.g. Currency, Money).
DataNucleus JPA has specific support for mapping an attribute to multiple columns, but that is not part of the JPA spec (i.e vendor extension).
There is no ability to map multiple entity attributes to one column (or to many columns).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With