Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDynamic JPA problem - empty Metamodel
https://www.eclipse.org/forums/index.php/mv/msg/250415/741504/#msg_741504
I'm trying to use the Dynamic JPA API as described here (grr I can't post links to this forum yet). Just google "EclipseLink Dynamic Persistence" and the first 2 hits should give you pages with these titles:
EclipseLink/Development/Dynamic - Eclipsepedia
EclipseLink/Examples/JPA/Dynamic - Eclipsepedia
I can get the querying to work as in the example. However, the Metamodel returned from the EntityManagerFactory is empty. Is that a bug? If not, why is it empty?
I had expected JPADynamicHelper.addTypes to populate the EMF Metamodel.
- Jerome]]>Jerome 2011-10-19T15:40:40-00:00Re: Dynamic JPA problem - empty Metamodel
https://www.eclipse.org/forums/index.php/mv/msg/250415/742581/#msg_742581
I downloaded the latest EclipseLink code and modified EntityManagerSetupImpl.getMetamodel() to return a null Metamodel instead of an empty one. Now after JPADynamicHelper.addTypes is called when I call EntityManagerFactory.getMetamodel for the first time it creates the Metamodel with my types. Yay!
However, I was doing all of this for an odata4j application. And during my next step, which was to supply my EntityManagerFactory to odata4j's JPAProducer I discovered that odat4j doesn't like the EclipseLink dynamic classes. I get the following exception:
Exception in thread "main" java.lang.ClassCastException: org.eclipse.persistence.internal.dynamic.ValuesAccessor cannot be cast to org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor
at org.eclipse.persistence.internal.jpa.metamodel.AttributeImpl.getJavaMember(AttributeImpl.java:139)
at org.odata4j.producer.jpa.JPAEdmGenerator.toEdmProperty(JPAEdmGenerator.java:107)
at org.odata4j.producer.jpa.JPAEdmGenerator.getProperties(JPAEdmGenerator.java:130)
at org.odata4j.producer.jpa.JPAEdmGenerator.buildEdm(JPAEdmGenerator.java:182)
at org.odata4j.producer.jpa.JPAProducer.<init>(JPAProducer.java:85)
at edu.vt.ipg.odatahandsdynamic.App.main(App.java:59)
So I'm giving up on this Dynamic JPA business. Just thought I'd post this in case it helps someone else.]]>Jerome 2011-10-20T16:13:54-00:00Re: Dynamic JPA problem - empty Metamodel
https://www.eclipse.org/forums/index.php/mv/msg/250415/742585/#msg_742585
I downloaded the latest EclipseLink code and modified EntityManagerSetupImpl.getMetamodel() to return a null Metamodel instead of an empty one. Now after JPADynamicHelper.addTypes is called when I call EntityManagerFactory.getMetamodel for the first time it creates the Metamodel with my types. Yay!
However, I was doing all of this for an odata4j application. And during my next step, which was to supply my EntityManagerFactory to odata4j's JPAProducer I discovered that odat4j doesn't like the EclipseLink dynamic classes. I get the following exception:
Exception in thread "main" java.lang.ClassCastException: org.eclipse.persistence.internal.dynamic.ValuesAccessor cannot be cast to org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor
at org.eclipse.persistence.internal.jpa.metamodel.AttributeImpl.getJavaMember(AttributeImpl.java:139)
at org.odata4j.producer.jpa.JPAEdmGenerator.toEdmProperty(JPAEdmGenerator.java:107)
at org.odata4j.producer.jpa.JPAEdmGenerator.getProperties(JPAEdmGenerator.java:130)
at org.odata4j.producer.jpa.JPAEdmGenerator.buildEdm(JPAEdmGenerator.java:182)
at org.odata4j.producer.jpa.JPAProducer.<init>(JPAProducer.java:85)
at edu.vt.ipg.odatahandsdynamic.App.main(App.java:59)
So I'm giving up on this Dynamic JPA business. Just thought I'd post this in case it helps someone else.]]>Jerome2011-10-20T16:13:54-00:00Re: Dynamic JPA problem - empty Metamodel
https://www.eclipse.org/forums/index.php/mv/msg/250415/748487/#msg_748487
]]>James Sutherland2011-10-24T18:14:40-00:00Re: Dynamic JPA problem - empty Metamodel
https://www.eclipse.org/forums/index.php/mv/msg/250415/748489/#msg_748489
--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/]]>James2011-10-24T18:14:40-00:00Re: Dynamic JPA problem - empty Metamodel
https://www.eclipse.org/forums/index.php/mv/msg/250415/996165/#msg_996165
https://bugs.eclipse.org/bugs/show_bug.cgi?id=397283
]]>Arieh Faiga2013-01-01T07:45:40-00:00