Open GoogleCodeExporter opened 8 years ago
as refered in the stackoverflow link, @embedded works,
but @ElementCollection is the interoperable standard.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/2.0/ElementCollections
Original comment by wokier
on 19 Jun 2013 at 7:12
@Embedded used on a collection only works when there is no data.
When i try to retrieve them, i get:
javax.jdo.JDOFatalUserException: No metadata has been registered for class
"[EmbeddedClass]"
The only workaround i got now is to clean the data with the datastore viewer,
and then re-persist my data.
Original comment by wokier
on 17 Jul 2013 at 10:12
Have you enhanced the @Embeddable classes, e.g., by adding them to
persistence.xml?
Original comment by geiger....@gmail.com
on 17 Jul 2013 at 11:32
I have tried with and wthout this declaration.
It does not change anything.
I am thinking about registering them manually throught
JDOImplHelper.registerClass but it needs som reflections stuff to retrieve
filds and types, and i don't know when to call it (before or after the
EntityManager creation).
Original comment by wokier
on 17 Jul 2013 at 12:22
I have discovered that registerClass is called by enhanced class. But this was
not done for the embeddedable classes, so i have put this code beetwen the
EntityManagerFactory creation and the EntityManager creation:
for (Class embeddableClass : new
Reflections("your.entities.package").getTypesAnnotatedWith(Embeddable.class)) {
try {
System.out.println(embeddableClass.newInstance());
} catch (InstantiationException e) {
LOGGER.warning(e.getClass() + " " + e.getMessage());
} catch (IllegalAccessException e) {
LOGGER.warning(e.getClass() + " " + e.getMessage());
}
}
and it works (with @Embedded)
Original comment by wokier
on 18 Jul 2013 at 1:58
Original issue reported on code.google.com by
geiger....@gmail.com
on 25 Apr 2013 at 12:19