Home » Modeling » EMF » Re: [Teneo/Hibernate] "javax.persistence" and bundles from elver.org update site
Re: [Teneo/Hibernate] "javax.persistence" and bundles from elver.org update site [message #638967] |
Sun, 14 November 2010 04:52 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Alex,
Ha, this was a mistake in the hibernate plugin. I have updated to the latest hibernate version yesterday so that's when
this error got introduced.
I have made new plugins available on the elver.org website which solve this issue. The hibernate plugin now does not
contain the javax.persistence jar anymore, it requires this to be provided by a separate plugin.
Let me know if it works fine for you now (or not ofcourse...).
btw, support for Teneo is given on the main EMF newsgroup which I added as cc.
gr. Martin
On 11/13/2010 12:09 PM, Alex wrote:
> Hi,
>
> I'm trying to setup a Teneo/Hibernate project and enable use of JPA for
> the data store (instead of the Hibernate session API).
>
> My problem is however, that the "org.hibernate" bundle from "elver.org"
> includes the "hibernate-jpa-2.0-api-1.0.0.Final.jar" via its runtime
> classpath, but does NOT export it. Therefore, to use JPA in my own code,
> I have to add a dependency to the "javax.persistence" (again from the
> "elver.org" update site) bundle, but this results in two separate
> definitions of JPA being in use.
>
> As a result, the following method I have defined in my bundle (which
> depneds on both "javax.persistence" and "org.hibernate") tries to
> provide access to the EntityManagerFactory as defined by
> "javax.persitence" the bundle but ends up trying to return an object
> that implements EntityManagerFactory as defined by the "org.hibernate"
> bundle:
>
> protected EntityManagerFactory getEntityManagerFactory() {
> //...
> HbEntityDataStore dataStore = new HbEntityDataStore();
> // ...
> dataStore.initialize();
> // ...
> return dataStore.getEntityManagerFactory();
> }
>
> This gives the linkage error below whyle trying to initialize the
> HbEntityDataStore (dataStore.initialize()).
> java.lang.LinkageError: loader constraint violation: when resolving
> method
> " org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactor y()Ljavax/persistence/EntityManagerFactory; "
> the class loader (instance of
> org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current
> class, org/eclipse/emf/teneo/hibernate/HbEntityDataStore, and the class
> loader (instance of
> org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for resolved
> class, org/hibernate/ejb/Ejb3Configuration, have different Class objects
> for the type javax/persistence/EntityManagerFactory used in the signature
> at
> org.eclipse.emf.teneo.hibernate.HbEntityDataStore.buildEntit yManagerFactory(HbEntityDataStore.java:242)
>
> at
> org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize (HbEntityDataStore.java:116)
>
>
> So my question is, can one use JPA to access a data store, or is one not
> supposed to do that? If yes, is that possible with the bundles provided
> by elver.org as a convenience, or do I have to create my own
> "org.hibernate" (one the would depend on "javax.persistence" for the JPA
> definition)?
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| |
Re: [Teneo/Hibernate] "javax.persistence" and bundles from elver.org update site [message #639015 is a reply to message #639008] |
Sun, 14 November 2010 19:18 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Alexandros,
Thanks for letting me know, this persistence jar is actually from eclipselink, that's what you get when doing copying...
I removed the activator and updated the update site, I hope it is solved!
gr. Martin
On 11/14/2010 06:00 PM, Alex wrote:
> Hi Martin,
>
> Well, for what it's worth, my "hello world" seems to work fine now, with
> just one quirk: The "javax.persistence" bundle declares an activator as
> "org.eclipse.persistence.javax.persistence.osgi.Activator". This causes
> a ClassNotFoundException at runtime (as no such class exists in the
> bundle), but otherwise things work fine.
>
> I've imported javax.persistence into my workspace and removed the
> activator in order to get a "clean" run. You might want to consider
> doing that for your update site as well (unless the activator does serve
> some purpose in other use cases).
>
> Thanks for your reply.
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Goto Forum:
Current Time: Thu Sep 26 17:05:44 GMT 2024
Powered by FUDForum. Page generated in 3.89827 seconds
|