Open gavinking opened 10 months ago
Note that this enhancement is also, IMO, needed in order to do #9 in an elegant way.
A limitation here, and, perhaps, an argument against doing it all, is that due to Java language limitations, nested @EmbeddableResult
s would not be allowed. That's annoying.
Section 3.10.16.1 of the spec specifies that embeddable objects returned by native queries are handled by specifying a property path using the
name
member of@FieldResult
. For example:This works but somehow I always found it slightly weird, bordering on inelegant, that, given that
@Embeddable
objects are a basic construct in the type system of JPA, there was no corresponding@EmbeddableResult
annotation.Is that better? Maybe not. We all hate nested annotations in Java!
But in light of #459, this code example can easily be made typesafe, whereas the first cannot:
And this is, in my opinion, sufficient reason to add such an annotation to JPA.