Issue
How can I avoid putting FQCN into SELECT NEW ...
?
Packages are often changed during refactoring, and that may cause troubles.
Not sure if I can do something for that in JPA; I am also happy with Hibernate 3.6 solution (Ejb3Configuration
).
Note that class used in SELECT NEW
is not an entity, so standard trick with <class>
in persistence.xml
doesn't work (YMMV).
Solution
As per the spec, the constructor name has to be fully qualified, JPA spec 4.8.2. So no, you can't avoid it. And why can't you just use MyClass.class.getName() and hence cope with refactorings?
Answered By - DataNucleus
Answer Checked By - David Marino (JavaFixing Volunteer)