Yes I did.
I finally worked it out.
Thanks everyone.

So, to summarize the solution that is working for me, let me elaborate:

I use EclipseLink implementation (JPA) - OSGi modules (installed by default
in Glassfish 3.1.1 in OSGi Felix)

I had 2 problems:

The first is where I'll get the MySQL driver

The solution:
MySQL driver is beyond the scope of the OSGi framework, so I have used
Glassfish AS 3.1.1 to configure MySQL JDBC connection pool and JDBC
resource, checked it and added the JDBC Resource name to the OSGi *
persistence.xml* *jta-data-source* label
(I'm using Apache Felix installed in Glassfish 3.1.1 AS)

The second problem was that the transactions didn't work with the JPA.
Meaning, I used the persist() method and it didn't save the data to the
database.

The solution:
With the help of  Sahoo from Oracle, I've learned that I need to use the
OSGi Transaction service.
So, all you need to do, is the following:

   1. Verify that the Transaction service is in the OSGi framework
   2. Check that the service is online (again, the transaction service is by
   default up and running in Glassfish 3.1.1)
   3. Use iPOJO, Service Tracker, etc... to get the transaction service in
   the JPA client
   4. Start working with the Trasaction service along with the JPA (start,
   commit, ...)

 I hope this will help others, and thank you all for your help

Regards
Shai Amar

Technologies manager, Founder
 Krynnlance
 www.krynnlance.com
 www.backapps.com

On Wed, Sep 21, 2011 at 5:59 PM, Allen Lau <[email protected]> wrote:

> Have you looked at the EclipseLink implementation?  We use it for DB2,
> Oracle, etc.
>
> On Wed, Sep 21, 2011 at 1:02 AM, Shai Amar <[email protected]>
> wrote:
>
> > Hi
> >
> > I have a simple problem and I hope that there is a simple solution.
> > I would like to use JPA in Felix and store data in a MySQL server.
> > I have been investigating this issue and I saw that there no simple
> example
> > for this, also, the examples that exists do not work.
> >
> > Can anyone tell me what bundles do I need for JPA and MySQL and provide a
> > simple example of how to use it?
> >
> >
> > --
> > Regards
> >
> > Shai Amar
> >
> > Technologies manager, Founder
> > Krynnlance
> > www.krynnlance.com
> > www.backapps.com
> >
>



-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

Reply via email to