Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Eclipselink 1.1-M4 create OSGI EntityManagerFactory

Thanks Tom and Tim.

I have seen the examples before but it looks like something has change in the most recent builds since i receive a:

org.eclipse.persistence.config.PersistenceUnitProperties cannot be resolved.
org.eclipse.persistence.jpa.osgi.PersistenceProvider cannot be resolved.

Once i import those packages, it still says:

Access restriction: the method createEntityManagerFactory(String, Map) from the type PersistenceProvider is not accessible due to a restriction on required library ...

If i use the Persistence.createEntityManagerFactory(persistenceUnitName) i get an error saying wasn't able to load that persistence unit name. what can i do? Against which build was run the svn demo?




On Mon, Dec 8, 2008 at 6:23 AM, Tim Hollosy <hollosyt@xxxxxxxxx> wrote:
Also check out my article here:
http://www.weheartcode.com/2008/08/27/eclipselink-in-j2se-rcp-applications/

It explains one way:

    properties.put(PersistenceUnitProperties.TARGET_DATABASE, "Derby");
       properties.put(PersistenceUnitProperties.JDBC_DRIVER,
               "org.apache.derby.jdbc.ClientDriver");
       properties.put(PersistenceUnitProperties.JDBC_URL,
               "jdbc:derby://localhost:1527/sample;create=true");
       properties.put(PersistenceUnitProperties.JDBC_USER, "app");
       properties.put(PersistenceUnitProperties.JDBC_PASSWORD, "app");
       properties
               .put(PersistenceUnitProperties.JDBC_READ_CONNECTIONS_MIN, "1");
       properties.put(PersistenceUnitProperties.JDBC_WRITE_CONNECTIONS_MIN,
               "1");

       properties.put(PersistenceUnitProperties.BATCH_WRITING, "JDBC");
       properties.put(PersistenceUnitProperties.CLASSLOADER,
ComicsEntityManagerFactory.class.getClassLoader());
       properties.put("eclipselink.logging.level", "FINE");
       properties.put("eclipselink.logging.timestamp", "false");
       properties.put("eclipselink.logging.session", "false");
       properties.put("eclipselink.logging.thread", "false");

       emf = new PersistenceProvider().createEntityManagerFactory("comics",
               properties);


./tch



On Mon, Dec 8, 2008 at 9:19 AM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
> Hi Erasmo,
>
>  A good way to get started with EclipseLink and OSGi is by looking at our
> RCP demo.  It creates an EntityManager using OSGi and does some simple
> queries.
>
>  The instructions about how to use it our in the examples folder of our SVN
> view.  Here is a link to the file so you can see it.
>
> http://dev.eclipse.org/viewsvn/index.cgi/trunk/examples/org.eclipse.persistence.example.jpa.rcp.comics/ReadMe.txt?root=RT_Eclipselink&view=log
>
>  All the instructions you need can be found in that file.
>
> -Tom
>
> http://wiki.eclipse.org/SVN_Howto
>
> Erasmo wrote:
>>
>> Does anybody knows how to create an EntityManagerFactory under osgi using
>> eclipselink milestone 4? It looks like the old
>> PersistentProvider.createEntityManagerFactory is dead or something, because
>> its commanded to throw an exception if someone calls its code. Any tester
>> outthere working with M4?
>>
>> Any help appreciated.
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top