JPA Embeddable Extension

I have an ABC nested class extended from another XYZ nested class. The ABC object is embedded in the object. The table corresponding to the entity contains only ABC elements, not XYZ. What should I do to get them?

I heard that Descriptor Customizer will work. How can I do it? Is there another way?

+4
source share
3 answers

This oracle javaEE document can help you. Accordingly, InheritanceType.SINGLE_TABLE is the default strategy. Your requirement may require InheritanceType.TABLE_PER_CLASS.

He described it in the Entity Inheritance Mapping Strategies tag, but I believe that it can also work for "Embeddable".

+1
source

You need to set the InIciterIndicatorField InheritancePolicy property in DescriptorCustomizer for XYZ. Then you need to define an aggregate descriptor for ABC, which extends XYZ, for this you may need a SessionCustomizer.

0
source

Can someone give an example of how to write this DescriptorCustomizer? I have the same thing that my XYZ class has a bunch of strings and uids. I cannot get an object with built-in ABC to display fields from XYZ. (The only way I could do this is to put getters in ABC for all XYZ fields and that is not good)

0
source

Source: https://habr.com/ru/post/1390003/


All Articles