Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Problem with getting gemini.jpa to work(Can't get the reference to jemini jpa osgi service)
Problem with getting gemini.jpa to work [message #1731516] Fri, 06 May 2016 11:44 Go to next message
Pavel No is currently offline Pavel NoFriend
Messages: 47
Registered: May 2016
Member
I use Java 8 and Felix 5.4.0. This is the bundle list I install and start BEFORE starting my main bundle.

    <bundle name="javax.persistence-2.1.1.jar"/>
  <bundle name="org.eclipse.persistence.asm-2.6.3-M1.jar"/>
  <bundle name="org.eclipse.persistence.antlr-2.6.3-M1.jar"/>
   <bundle name="org.eclipse.persistence.core-2.6.3-M1.jar"/>
   <bundle name="org.eclipse.persistence.jpa-2.6.3-M1.jar"/>
   <bundle name="org.eclipse.persistence.jpa.jpql-2.6.3-M1.jar"/>
   <bundle name="org.eclipse.gemini.jpa_1.2.0.M1.jar"/>
   <bundle name="org.eclipse.gemini.dbaccess.h2-1.1.0.RELEASE.jar"/>
   <bundle name="org.eclipse.gemini.dbaccess.util_1.1.0.201206011559.jar"/>


To manifest of bundle with persistence.xml I added:
Meta-Persistence: META-INF/persistence.xml (Although I am not sure it is necessary)

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 
    xmlns="htt p://java.sun.com/xml/ns/persistence"
    xmlns:xsi="htt p://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="htt p://java.sun.com/xml/ns/persistence htt p://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="myPersistenceUnit" transaction-type="RESOURCE_LOCAL">
      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.temp.PersonItem</class>
    <properties>
      <!-- Configuring JDBC properties -->
      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
      <property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost//home/data/database"/>
      <property name="javax.persistence.jdbc.user" value="sa"/>
      <property name="javax.persistence.jdbc.password" value=""/>
      <property name="eclipselink.logging.level" value="FINE"/>
            <property name="eclipselink.logging.timestamp" value="false"/>
            <property name="eclipselink.logging.thread" value="false"/>
            <property name="eclipselink.logging.exceptions" value="true"/>
            <property name="eclipselink.orm.throw.exceptions" value="true"/>
            <property name="eclipselink.jdbc.read-connections.min" value="1"/>
            <property name="eclipselink.jdbc.write-connections.min" value="1"/>                        
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
            <property name="eclipselink.weaving" value="true"/>
    </properties>
  </persistence-unit>
</persistence>


This is the code how I try to get gemini service
BundleContext context = thisBundle.getBundleContext();
        ServiceReference serviceReference = context.getServiceReference( EntityManagerFactory.class.getName() );
        if (serviceReference==null){
            System.out.println("@@@:1"); // I COME HERE
        }else{
            System.out.println("@@@:2");
        }
        emf= (EntityManagerFactory) context.getService( serviceReference );
        String unitName = (String)serviceReference.getProperty(EntityManagerFactoryBuilder.JPA_UNIT_NAME);
        System.out.println("Name:"+unitName);


Please, help me to solve this problem. P.S. I added space in http because otherwise I couldn't post this topic.
Re: Problem with getting gemini.jpa to work [message #1731535 is a reply to message #1731516] Fri, 06 May 2016 15:11 Go to previous messageGo to next message
Michael Keith is currently offline Michael KeithFriend
Messages: 243
Registered: July 2009
Senior Member
Is the EMF getting registered as a service? Check the output, and also see if the DBAccess bundles are being loaded because if they are not loaded first Gemini JPA won't find them and won't register the EMF service.
Re: Problem with getting gemini.jpa to work [message #1731548 is a reply to message #1731535] Fri, 06 May 2016 17:05 Go to previous message
Pavel No is currently offline Pavel NoFriend
Messages: 47
Registered: May 2016
Member
Thank you very much. It helped.
Previous Topic:Javax.Persistence Problem
Next Topic:Gemini Blueprint 2.0.0 released
Goto Forum:
  


Current Time: Thu Apr 18 18:27:29 GMT 2024

Powered by FUDForum. Page generated in 0.03330 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top