[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [eclipselink-users] Does OSGI work?
- From: "Tim Hollosy" <hollosyt@xxxxxxxxx>
- Date: Wed, 6 Aug 2008 16:06:37 -0400
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=iCWJ1dMXlJ38ccxDCxinRHOhWFoWnBGL9qSwmj77I/c5sQDHDphHCNub0aqUCjxw8f FT82XANHTfOFyKJ2PRNfNJFkrTVaSUj2OiAd1fi4x+zYkwEjgr2HGhFP8BytEXikbGI6 TXzlCt+uYMBal3lKunMzMPKXxPxqAPiG9lNRA=
I have not tried #1 or #3. We use #2.
I posted this in an earlier thread today (maybe before you joined the
list, so I'll repeat).
I'll do my best, maybe explaining our set up will help you.
util.jpa: Contains a special EntityManagerFactoryFactory :) This
takes care of all the config in one place.
It takes 2 parameters:
So let's say i have my project
myproj.model which contains entities, and a persistence unit. To
"connect" this project to EclipseLink, I just call:
this.getClass().getClassLoader()); in the Activator of the plugin,
now i have an EntityManagerFactory that can be used in my project to
get new EntityManagers. So the EmfFactory handles creating the
database connection and setting up an EntityManagerFactory.
The golden rule with the OSGI stuff is Managed Entities CANNOT cross
classloader boundries. However, you can keep mappedsuperclasses in a
different classloader, that's fine.
If you would like more details about our RCP/OSGi set up please let me
know, I plan on creating a blog post about it anyway.
Hope this helps.
That clear things up any?
On Wed, Aug 6, 2008 at 3:58 PM, Hugo Garcia <hgarcia@xxxxxxxxxxxx> wrote:
> Ok... lets document how the newbie does it :)
> First off....
> What is the difference between the following and is there one that is
> more recommended that the others?
> With the above features, it is possible for client code to obtain an
> EntityManagerFactory three different ways:
> 1. Using the standard Java Persistence API with configuration
> behind the scenes using OSGi services and Manifest properties for
> configuration. See "org.eclipse.persistence.demo.jpa.osgi.spi" for an
> 2. Using the standard Java Persistence API--classloader to use for
> a given persistence unit passed in a property to
> createEntityManagerFactory instead of Manifest configuration. See
> "org.eclipse.persistence.demo.jpa.osgi.spi.classloader" for an
> 3. Using EclipseLink OSGi specific JPA Persistence Provider
> requiring no OSGi configuration. See
> "org.eclipse.persistence.demo.jpa.osgi.provider" for an example
> eclipselink-users mailing list