I have re-tested [HHH-10857] with Hibernate 5.4.15:
* For “simple” Embeddables (directly used in the Entity as @Embedded), @Convert annotation works.
* For Embeddables in ElementCollections, @Convert annotation also works now. So, the original issue [HHH-10857] seems to be fixed.
* However, in the following situation, @Convert is still ignored: ** I have an Element Collection of an Embeddable OuterEmbeddable. ** “OuterEmbeddable“ contains another Embeddable called InnerEmeddable ** Within InnerEmeddable I use @Convert on basic fields. But it is ignored.
My current workaround is to use @Convert one level higher:
{code:java}@Embeddable class OuterEmbeddable{ @Convert(converter = MyConverter.class, attributeName = "theFieldToConvert") InnerEmeddable theInnerEmbeddable }{code}
My testcase reveals some more details:
* It works if I enforce field level access on the embeddables inner embeddable by “@Access(AccessType.FIELD)“ * The error occurs (but only on the inner embeddable, as described above) if I do not enforce field level access.
So I assume, Hibernate for some reasons detects field level access on the outer embeddable but property level access on the inner embeddable.
And property level access leads to ignoring the Convert annotation on the inner embeddable. |
|