Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Gemini JPA: Getting Started?(OSGi is working, JPA with EclipseLink is working, but how to...)
Gemini JPA: Getting Started? [message #1061965] Wed, 05 June 2013 03:42 Go to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
Hello!

i created a persistence with JPA and EclipseLink (tested in an standalone app) which works fine.
when moving to my main Application (multiple bundles and Application) eclipse was no more able to find my persistence;

this is why i try to move to gemini jpa.

my problem right now is that i was not able to find out how to get started (the only document i found was this )


in this context i have the exampe of Configuration Admin but nothing points to how or where i can get this admin from.
i thought its an osgi service, but i do not have it in my list of services...

any help / tutorial / example would be welcome

thanks in advance
Ludwig
Re: Gemini JPA: Getting Started? [message #1062021 is a reply to message #1061965] Wed, 05 June 2013 08:56 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
Hi Ludwig,

You should probably start by reading the beginning sections of the Gemini JPA documentation on the wiki. Start with the Installing section and then move on to Creating An Application, etc.

There is also a "Getting Started" file in the Gemini JPA distribution that shows you how to set up and run the example that is shipped with Gemini JPA. If you have any problems trying the example post your questions back to this forum.

-Mike
Re: Gemini JPA: Getting Started? [message #1062122 is a reply to message #1062021] Thu, 06 June 2013 02:24 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
i already ran through these documents, but i did not download the package via webpage i installed it via updatemanager in eclipse, therefore the sample was not downloaded. now i got the sample.

in my case i got a main application and some bundles (thats where i use gemini)
i called my bundle lumo.osgi.service.eclipselink.impl (yep, there is also a bundle without impl.)

i copied the activator from the sample to my bundle and modified the addingService method:
public Object addingService(ServiceReference ref)
  {
    Bundle b = ref.getBundle();
    Object service = b.getBundleContext().getService(ref);
    String unitName = (String)ref.getProperty("osgi.unit.name");

    if (unitName.equals("EclipseLinkTest")) {
    	System.out.println("EclipseLinkTest started");
//      new AccountClient().run((EntityManagerFactory)service);
    }
    return service;
  }

note: EclipseLinkTest is the name of my persistence unit defined in my src/META-INF/persistence.xml

further i added to my MANIFEST.MF the following lines:
Meta-Persistence: META-INF/persistence.xml
Bundle-Activator: osgi.Activator


my persistence.xml looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
  version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
  <persistence-unit name="EclipseLinkTest" transaction-type="RESOURCE_LOCAL">
  <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  <mapping-file>META-INF/eclipselink-orm.xml</mapping-file>    
    <properties>
      <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
      <property name="javax.persistence.jdbc.url" value="jdbc:h2:D:/JAVA/relationsshipDb" />
      <property name="javax.persistence.jdbc.user" value="admin" />
      <property name="javax.persistence.jdbc.password" value="" />
      <!-- EclipseLink should create the database schema automatically -->
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
      <property name="eclipselink.ddl-generation.output-mode" value="database" />
      <property name="eclipselink.weaving" value="true"/>
    </properties>

  </persistence-unit>
</persistence>


when launching the application, the service gets started
log: Gemini JPA Basic Sample started.

but thats it. there is no log "EclipseLinkTest started" which i would expect to fire up.

did i miss something important from the example?

UPDATE:

just scrolled through the logs and found this:

!MESSAGE the bunldle initial@reference:file:plugins/org.eclipse.gemini.jpa_1.1.0.RELEASE/ not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.327
!MESSAGE the imported package javax.persistence_1.1.0 missing.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.342
!MESSAGE the imported package javax.persistence.criteria_1.1.0 missing.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.342
!MESSAGE the imported package javax.persistence.metamodel_1.1.0 missing.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-06 10:38:36.342
!MESSAGE the imported package javax.persistence.spi_1.1.0 missing.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-06 10:38:36.342


my require says
javax.persistence 2.1.0
org.eclipse.persistence.antlr 3.2.0
org.eclipse.persistence.asm 3.3.1
org.eclipse.persistence.core 2.5.0
org.eclipse.persistence.jpa 2.5.0
osgi.enterprise 4.2.0
and i included those jars in runtime.
this way the service starts but gemini not.
if i add
osgi.eclipse.gemini.jpa 1.1.0
to required
then the service does not start either. but the warnings are no more logged.


lumo

[Updated on: Thu, 06 June 2013 04:49]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1062268 is a reply to message #1062122] Thu, 06 June 2013 16:59 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
Hi Ludwig,

It sounds like you are running from within Eclipse, so you should be able to see the bundles and their status. (If you have the org.eclipse.equinox.console bundle then you can type "ss".) You can see if a required bundle is missing because it will not be resolved, and if you try to start it you will see the exception from the command line.

To make sure you have all the required bundles try using a Run Configuration (Run->Run Configuration) and include all the bundles that you need to run. Also, on the arguments tab include the line:
-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -clean
for the "Program arguments". Then for the "VM arguments":
-Declipse.ignoreApp=true -Dosgi.noShutdown=true -DGEMINI_DEBUG

Hope this helps,
-Mike
Re: Gemini JPA: Getting Started? [message #1062419 is a reply to message #1062268] Fri, 07 June 2013 11:06 Go to previous messageGo to next message
Michael Gruebsch is currently offline Michael Gruebsch
Messages: 16
Registered: March 2012
Junior Member
Hi Mike and Ludwig,

I have the same problem. In my target environment there is eclipse link 2.5.0 and gemini jpa 1.1.0. In Eclipse under run configurations I created a new OSGI Framework configuration. I added only
org.eclipse.gemini.jpa
to the list of bundles. After that I pressed the button "Add Required bundles". This selects 28 plugins, including
javax.persistence  2.1.0
.

When pressing the button "Validate bundles" I get the message, that 4 bundles
javax.perstence, version 1.1.0
are missed.

What is going wrong? Thank you!
Michael

[Updated on: Mon, 10 June 2013 01:17]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1062616 is a reply to message #1062419] Mon, 10 June 2013 01:12 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
@mike, i got all the Program arguments included, which are you mentioning.
not the VM arguments.
i wrote a plugin/view, which indicates me if a OSGi service is not up and running (which should be running).
@michael thats exactly what i get too (so my problem is reproduceable - thanks for your post)

[Updated on: Mon, 10 June 2013 01:24]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1062853 is a reply to message #1062616] Tue, 11 June 2013 02:17 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
i resolved my problems! and EclipseLink is now working with JPA in an OSGi Service.
fact is that i dropped gemini, to get it working.

import org.eclipse.persistence.jpa.PersistenceProvider;

private static final String PERSISTENCE_UNIT_NAME = "EclipseLinkTest";

// init
PersistenceProvider p = new PersistenceProvider();
		Map map = new HashMap();
		map.put(PersistenceUnitProperties.CLASSLOADER,
				getClass().getClassLoader());
		factory = p.createEntityManagerFactory(
				PERSISTENCE_UNIT_NAME, map);


this works like charm for me.
@Michael Gruebsch let me know if this also resolves your problem.
Re: Gemini JPA: Getting Started? [message #1062878 is a reply to message #1062853] Tue, 11 June 2013 04:52 Go to previous messageGo to next message
Michael Gruebsch is currently offline Michael Gruebsch
Messages: 16
Registered: March 2012
Junior Member
@Ludwig Do you have Gemini in the list of your plugins? Which version of EclipseLink are you using? If Gemini is not in the list of your plugins: do you have lazy dependenccies? If yes please set eclipselink.logging.level=WARNING and check if lazy loading is still active or if it is reverted.

I wanted to deploy Gemini to enable dynamic weaving. Weaving is the precondition that lazy loading works.

Michael
Re: Gemini JPA: Getting Started? [message #1062890 is a reply to message #1061965] Tue, 11 June 2013 05:20 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
Gemini is no more in teh list of my plugins.
i am using the latest version of EclipseLink (2.5)
i do have lazy dependencies but i did not test if its active or not (yet)
Re: Gemini JPA: Getting Started? [message #1063098 is a reply to message #1061965] Wed, 12 June 2013 06:05 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
Hi,

Are you trying to implement an OSGi application or an Eclipse RCP application? This makes a huge difference, as when Entity-Weaving is activated, Gemini restarts all dependend bundles, which causes strange behaviour. Anyhow.

Can you post your target-platform? I had no problem with EclipseLink 2.4.1 and Gemini JPA 1.1.0

You can checkout a sample application with Gemini at https://github.com/muuki88/e4GeminiJPA.

The product configuration can be found at https://github.com/muuki88/e4GeminiJPA/blob/master/de.mukis.gemini.sample.site/de.mukis.gemini.sample.product

If this doesn't help, can you publish a small sample app demonstrating the problem?

cheers,
Muki
Re: Gemini JPA: Getting Started? [message #1063110 is a reply to message #1063098] Wed, 12 June 2013 07:26 Go to previous messageGo to next message
Michael Gruebsch is currently offline Michael Gruebsch
Messages: 16
Registered: March 2012
Junior Member
@Nepomuk Seiler

Speaking for me I implement an Eclipse RCP application. My configuration is EclipseLink 2.5 + Gemini/JPA 1.1.0.

To me it seems that Gemini 1.1.0 and EclipseLink 2.5.0 are not compatible because of missing capabilities.

However, Gemini 1.1.0 requires at least EclipseLink 2.4.0. So earlier versions of EclipseLink can not be used.

EclipseLink 2.4.0 and 2.4.1 have a bug: when there are MappedSuperClasses from other bundles then a NPE is thrown. This bug is resolved in EclipseLink 2.4.2. However, this version seems not to have an official release repository.


Michael
Re: Gemini JPA: Getting Started? [message #1063137 is a reply to message #1063110] Wed, 12 June 2013 08:58 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
same here, i am using it in an Eclipse RCP Application
Re: Gemini JPA: Getting Started? [message #1063172 is a reply to message #1063137] Wed, 12 June 2013 10:16 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
@Nepomuk Seiler i looked through your sample and i can't find much of a difference to what i did.

i'm using H2 database but no DBAccess (will try that now)
and i am using Eclipse 3.7 not e4
Re: Gemini JPA: Getting Started? [message #1063195 is a reply to message #1063172] Wed, 12 June 2013 11:15 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
i downloaded your examples and installed fresh eclipse 4.2 (RCP)
eclipse moans about missing libraries org.eclipse.gemini.ext.di

so i downloaded the package from
org.eclipse.gemini.ext.di.updatesite - http://p2.mukis.de/org.eclipse.gemini.ext.di/


then i went to de.mukis.gemini.sample.rcp/META-INF/MANIFEST.MF
and clicked on Launch as Eclipse Application.
application fires up and when switching to OSGi-Console
25	INSTALLED   de.mukis.gemini.sample.rcp_0.0.1.qualifier

running command
start 25

the following error pops up:
Quote:
gogo: BundleException: The bundle "de.mukis.gemini.sample.rcp_0.0.1.qualifier [25]" could not be resolved. Reason: Package uses conflict: Require-Bundle: org.eclipse.gemini.ext.di; bundle-version="1.0.0"



its too late today, but i will try to pop up a small example rcp (with multiple plugins to demonstrate the problem)
i will use e4 so you do not have problems with dependencies etc.
Re: Gemini JPA: Getting Started? [message #1063198 is a reply to message #1063195] Wed, 12 June 2013 11:23 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
Hi,

My example application uses a special e4 package to inject persistence contexts in JavaEE style.
The update site doesn't seem quite right. Try

http://p2.mukis.de/org.eclipse.gemini.ext.di/latest


I recommend to create a custom target platform instead of installing to your eclipse IDE.
It's easier to build it with Tycho afterwards.

However I will try to update to EclipseLink 2.5.x and check if I encounter errors.

Cheers,
Muki
Re: Gemini JPA: Getting Started? [message #1063392 is a reply to message #1063198] Thu, 13 June 2013 01:17 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
when running your example i encounter the following log:
(multiple:)
!ENTRY org.eclipse.equinox.ds 4 0 2013-06-13 07:16:00.406
!MESSAGE Could not bind a reference of component org.eclipse.gemini.ext.di.emf. The reference is: Reference[name = IPreferencesService, interface = org.eclipse.core.runtime.preferences.IPreferencesService, policy = dynamic, cardinality = 0..1, target = null, bind = bindPreferencesService, unbind = unbindPreferencesService]

!ENTRY org.eclipse.equinox.ds 4 0 2013-06-13 07:16:00.421
!MESSAGE Could not bind a reference of component org.eclipse.gemini.ext.di.em. The reference is: Reference[name = EntityManagerFactory, interface = javax.persistence.EntityManagerFactory, policy = dynamic, cardinality = 0..n, target = null, bind = bindEntityManagerFactory, unbind = unbindEntityManagerFactory]

!ENTRY org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa.sample.configadmin_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa.sample.configadmin.pu_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa.sample.basic_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.625
!MESSAGE Bundle reference:file:/D:/JAVA/eclipse4.2/plugins/org.eclipse.gemini.jpa_1.1.0.RELEASE/ was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.spi_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.625
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.

!ENTRY org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa_1.1.0.RELEASE [238] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.spi_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa.sample.basic_1.1.0.RELEASE [239] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.basic 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa.sample.configadmin_1.1.0.RELEASE [240] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package model.configadmin_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-13 07:16:01.656
!MESSAGE Bundle org.eclipse.gemini.jpa.sample.configadmin.pu_1.1.0.RELEASE [242] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.criteria_1.1.0.
!SUBENTRY 2 org.eclipse.gemini.jpa.sample.configadmin.pu 2 0 2013-06-13 07:16:01.656
!MESSAGE Missing imported package javax.persistence.metamodel_1.1.0.


all i did was checking the sample out from git, and download the package from your update site
http://p2.mukis.de/org.eclipse.gemini.ext.di/latest


thats exactly the same error we get in our RCP's
Re: Gemini JPA: Getting Started? [message #1063393 is a reply to message #1063392] Thu, 13 June 2013 01:18 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
forgot to note this from the osgi console:
481	INSTALLED   org.eclipse.gemini.jpa_1.1.0.RELEASE
482	INSTALLED   org.eclipse.gemini.jpa.sample.basic_1.1.0.RELEASE
483	INSTALLED   org.eclipse.gemini.jpa.sample.configadmin_1.1.0.RELEASE
484	RESOLVED    org.eclipse.gemini.jpa.sample.configadmin.gen_1.1.0.RELEASE
485	INSTALLED   org.eclipse.gemini.jpa.sample.configadmin.pu_1.1.0.RELEASE

osgi> start 481

gogo: BundleException: The bundle "org.eclipse.gemini.jpa_1.1.0.RELEASE [481]" could not be resolved. Reason: Missing Constraint: Import-Package: javax.persistence; version="1.1.0"


hope this helps
Re: Gemini JPA: Getting Started? [message #1063666 is a reply to message #1061965] Thu, 13 June 2013 12:37 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
There is already bug for this problem here https://bugs.eclipse.org/bugs/show_bug.cgi?id=410122

Gemini JPA's dependency for javax.persistence is not up-to-date with EclipseLink:

Import-Package: javax.persistence; version="1.1.0"


You can fork Gemini JPA at http://git.eclipse.org/c/gemini.jpa/org.eclipse.gemini.jpa.git
and try to provide a patch or use older EclipseLink Sad

cheers,
Muki
Re: Gemini JPA: Getting Started? [message #1063669 is a reply to message #1063666] Thu, 13 June 2013 13:01 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
Hi,

I am working on this bug right now to enable both EclipseLink's new 2.5 release (and 2.4.2, which is not yet released).
You should very soon be able to use Gemini JPA with these two versions.

-Mike
Re: Gemini JPA: Getting Started? [message #1063681 is a reply to message #1063669] Thu, 13 June 2013 13:52 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
BTW, this bug also plays a role:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=408607
Re: Gemini JPA: Getting Started? [message #1063849 is a reply to message #1061965] Fri, 14 June 2013 09:22 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
where can i sign up to get notice when this bug is fixed?
actually i got a deadline at end of this month. so all i can do is hope it gets fixed fast?
Re: Gemini JPA: Getting Started? [message #1063913 is a reply to message #1063849] Sat, 15 June 2013 03:22 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
Just follow the links given by Mike and me. One bug is already fixed.

[Updated on: Wed, 19 June 2013 04:29]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1064409 is a reply to message #1063913] Wed, 19 June 2013 02:48 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
so when i use this update site,
the fix is already included?
http://download.eclipse.org/gemini/jpa/updates
Re: Gemini JPA: Getting Started? [message #1064411 is a reply to message #1064409] Wed, 19 June 2013 03:02 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
or do i have to fork
http://git.eclipse.org/c/gemini.jpa/org.eclipse.gemini.jpa.git
and compile it myself?
Re: Gemini JPA: Getting Started? [message #1064425 is a reply to message #1064411] Wed, 19 June 2013 04:33 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
The Milestone Release seems to include the fix. So you can use the p2 update site.
Re: Gemini JPA: Getting Started? [message #1065675 is a reply to message #1061965] Thu, 27 June 2013 02:05 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
i checked the milestone.
this is what i did

1) start eclipse with a fresh workspace.
2) creating a new plugin with the org.eclipse.gemini.jpa.sample.basic_1.2.0.M1.jar
3) create a .target definition which includes DBAccess 1.1.0 RELEASE and Gemini 1.2 M
also EclipseLink 2.5.0 is in this target. (also eclipse is in the target.)

when i start the application i get the following log:

!SESSION 2013-06-27 08:03:56.202 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_AT
Framework arguments:  -product org.eclipse.platform.ide
Command-line arguments:  -product org.eclipse.platform.ide -data D:\JAVA\Workspace2013/../runtime-EclipseApplication -dev file:D:/JAVA/Workspace2013/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

!ENTRY org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE Bundle reference:file:/M:/EclipseTargetPlatform/gemini/gemini-dbaccess-1.1.0.RELEASE-updates/plugins/org.eclipse.gemini.dbaccess.hsqldb_1.1.0.RELEASE.jar was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.hsqldb.jdbc.pool_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.hsqldb.jdbc_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE Bundle reference:file:/M:/EclipseTargetPlatform/gemini/gemini-dbaccess-1.1.0.RELEASE-updates/plugins/org.eclipse.gemini.dbaccess.mysql_1.1.0.RELEASE.jar was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package com.mysql.jdbc.jdbc2.optional_[5.0.0,6.0.0).
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package com.mysql.jdbc_[5.0.0,6.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.327
!MESSAGE Bundle reference:file:/M:/EclipseTargetPlatform/gemini/gemini-dbaccess-1.1.0.RELEASE-updates/plugins/org.eclipse.gemini.dbaccess.h2_1.1.0.RELEASE.jar was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.h2_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.327
!MESSAGE Missing imported package org.h2.jdbcx_0.0.0.

!ENTRY org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE Bundle org.eclipse.gemini.dbaccess.h2_1.1.0.RELEASE [199] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.h2_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.h2 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.h2.jdbcx_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE Bundle org.eclipse.gemini.dbaccess.hsqldb_1.1.0.RELEASE [200] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.hsqldb.jdbc_0.0.0.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.hsqldb 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package org.hsqldb.jdbc.pool_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2013-06-27 08:04:01.343
!MESSAGE Bundle org.eclipse.gemini.dbaccess.mysql_1.1.0.RELEASE [201] was not resolved.
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package com.mysql.jdbc_[5.0.0,6.0.0).
!SUBENTRY 2 org.eclipse.gemini.dbaccess.mysql 2 0 2013-06-27 08:04:01.343
!MESSAGE Missing imported package com.mysql.jdbc.jdbc2.optional_[5.0.0,6.0.0).


please let me know whats going wrong or what i shall include.
the bundles/jar files are exactly where the log says they are searched.
do i need anything additional?

if i could get the examples up running, it would be way easier to find out how stuff works (and apply the code to my project)

just for your information.
i tried to integrate the sample into my application.
there none of the above messages gets logged, but
the Activator only logs out that "Gemini JPA Basic Sample started
and addingService gets never called...

[Updated on: Thu, 27 June 2013 02:23]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1065705 is a reply to message #1065675] Thu, 27 June 2013 04:24 Go to previous messageGo to next message
Michael Gruebsch is currently offline Michael Gruebsch
Messages: 16
Registered: March 2012
Junior Member
@Ludwig Do you need all the plugins from DBAccess? From DBAccess include only those plugins in your dependencies which you really need: the *.enterprise plugin as well as the plugin for your database product.

What is your database target product?

Michael
Re: Gemini JPA: Getting Started? [message #1065714 is a reply to message #1065705] Thu, 27 June 2013 04:53 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
Michael, first of all thanks for taking time investigating what i'm doing wrong!

my database is either h2 or microsoft sql (no provider for this one available yet, but if h2 is working i can solve this and if i get it working i'll publish it here) [BOTH databases must be supported in my final product!]

but back to my problem.
i just try to run the basic example.
here is a screenshot of my plugin-project's structure, dependencies and target (i doubt there is something wrong with it but please give it a look)
i do no more get the unresolved messages from above.
but the Activator does not launch up at all...


PS: i start feeling like a total noob Wink

[Updated on: Thu, 27 June 2013 04:55]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1065734 is a reply to message #1065714] Thu, 27 June 2013 06:12 Go to previous messageGo to next message
Michael Gruebsch is currently offline Michael Gruebsch
Messages: 16
Registered: March 2012
Junior Member
Ludwig,

did you set the start level of the gemini plugin? Please set Gemini debug options and look through the debug output. Your dependencies and target look fine to me although I am a Gemini novice too

Michael
Re: Gemini JPA: Getting Started? [message #1065753 is a reply to message #1065734] Thu, 27 June 2013 07:46 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
i did not set the startlevel before (as i try to not touch any startlevels at all!)
i added debug options.

now i set gemini jpa and the example to autostart and i get this log
this time gemini is starting, the activator is starting too, but thats it, no addingService (which should be called and '*** Account Report ***' logged...., right?)
Re: Gemini JPA: Getting Started? [message #1065754 is a reply to message #1065734] Thu, 27 June 2013 07:46 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
michael did you get the exampe from Nepomuk running?

finally, after loads of moaining i got his example running (but not out of the box, i had to change some things here and there :-/ but it says SAVED! now... so next step for me is getting this little baby running in my application ... I NEED TO! Very Happy

[Updated on: Thu, 27 June 2013 09:10]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1065876 is a reply to message #1065754] Fri, 28 June 2013 02:47 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
@Nepomuk Seiler i got your example running, but i do not get an idea how to specify connection details (as my users need to enter connection details in a dialog)
an hardcoded persistence.xml is no option for me (as users may change their database completely - different driver, different server, database login and password...)

so all those annotations make no sense for dynamic bound connections... or do i understand something wrong?
Re: Gemini JPA: Getting Started? [message #1066707 is a reply to message #1061965] Wed, 03 July 2013 17:34 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
Hi Ludwig,

Yep, you understand something wrong Smile

First of all you can configure everything hardcoded with the annoations, but mentioned in the Readme (https://github.com/muuki88/org.eclipse.gemini.ext.di) you can bind your settings to the preference store.

In the sample application there are some samples how to handle this. The current way may not be the optimal way, however it works:


Binding preferences at application start
https://github.com/muuki88/e4GeminiJPA/blob/master/de.mukis.gemini.sample.rcp/src/de/mukis/gemini/sample/rcp/handlers/SavePersonPreferencesHandler.java

Binding preferences without application restart
https://github.com/muuki88/e4GeminiJPA/blob/master/de.mukis.gemini.sample.rcp/src/de/mukis/gemini/sample/rcp/handlers/SavePersonPreferencesHandler2.java

Take a closer look at the examples here:
https://github.com/muuki88/e4GeminiJPA/tree/master/de.mukis.gemini.sample.rcp/src/de/mukis/gemini/sample/rcp/handlers


Why I say it's not the optimal way. The current implementation of gemini.ext.di doesn't react on changes in the preference and reinjects entitymanagers/entitymanagerfactories where neccessary. So you do the workaround by injecting new DAOs each time.

hope that helps,
Muki

Re: Gemini JPA: Getting Started? [message #1066720 is a reply to message #1066707] Thu, 04 July 2013 01:22 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
in your example 'Binding preferences without application restart'
https://github.com/muuki88/e4GeminiJPA/blob/master/de.mukis.gemini.sample.rcp/src/de/mukis/gemini/sample/rcp/handlers/SavePersonPreferencesHandler2.java
i dont get the point, where you set preferences... you save a DOA

i cant find any example where you do stuff without annotations (hardcoded config)
i'd need user input from a dialog which gets used in one of the handlers (afaik you cannot pass arguments into annotations...)


let me short explain what i need to get working (and what i got)
till now i had Hibernate in OSGi (but it fails at some point of my model - therefore i switch to EclipseLink, which resolves the problem fine!)
With EclipseLink i had to use JPA, and those two seem to have problems in OSGi, as Eclipse Bundles.

i had (with Hibernate) a Service, which creates a Connection and serves a Session to the database.
i was able to load/save stuff from this service (this service also monitors if something changed in the Data (in the time between load until i click save -> if nothing changed the object is thrown away, otherwise it updates the data))

this service has to be configured at runtime by passing: host, port, username and password (database driver etc... are preconfigured per PersistenceService)
my application provides multiple PersistenceServices, which means i can load stuff from different sources (all based on the same model, but can be totally different in how to retrieve the data) and save it to whatever PersistenceService i want in my application. (this for data Import/Export and merging)

so when i try to do this with gemini my problem is that gemini starts and stops the service at will (with a single query it reloaded the service.

so when working with the preferences store i need the root node of the settings
(changing the settings would look like this then?)
sorry i am totally new to Injection, those Annotations and e4 (used e3 for few years though)

public void configure(){
Preferences prefs= ConfigurationScope.INSTANCE
  .getNode("org.eclipse.gemini.???.???");
  // More stuff...
	prefs.put(PersistenceUnitProperties.JDBC_DRIVER, "org.gjt.mm.mysql.Driver");
	prefs.put(PersistenceUnitProperties.JDBC_URL, "jdbc:mysql://127.0.0.1/test");
	prefs.put(PersistenceUnitProperties.JDBC_USER, "test");
	prefs.put(PersistenceUnitProperties.JDBC_PASSWORD, "test");
  // Persists
  try {
  prefs.flush();
    } catch (BackingStoreException e) {
      e.printStackTrace();
    }
} 



i'm really willed to get this working & i tried to get this stuff working for more than a week now, its driving me nuts.

[Updated on: Fri, 05 July 2013 01:51]

Report message to a moderator

Re: Gemini JPA: Getting Started? [message #1066768 is a reply to message #1066720] Thu, 04 July 2013 05:48 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
parallel i try to get the 'simple' gemini CM sample to work, but i cant get it from starting and stopping services (minimum two times)

gen.start()
gen.createConfig()
client.start()
client.addingService(LibraryPersistenceUnit)
Gemini JPA Sample Configuration Generator created configuration.
client.stop()
client.start()
client.addingService(LibraryPersistenceUnit)
Re: Gemini JPA: Getting Started? [message #1066907 is a reply to message #1061965] Fri, 05 July 2013 02:38 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 319
Registered: July 2009
Senior Member
@Nepomuk Sailer i'd pay for a solution which works for my needs (though i can't pay much - but i cant get this working as needed so i really need help.

requirement: application launches, an OSGi Service registers at one of my Services.
iff the service gets selected as PersistenceService it gets the login details and shall connect to the given database (this needs to be possible two times - means two differend sources/targets. needed eg. as import/export/migration - datamodel is always the same)
important part is that the service starts when i ask it, and ends when program gets shut down. the user must be able to disconnect and connect again (to any other db/embedded/file)

imho my needs are nothing special (more something 0-8-15) and thats why i wonder nothing is coming up on google Wink

btw: i cloned https://github.com/muuki88/e4GeminiJPA and when i run it it says derby not found/nullpointer
Re: Gemini JPA: Getting Started? [message #1066990 is a reply to message #1066907] Fri, 05 July 2013 07:06 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
Hi,

I'm currently a bit short on time, so apologize my short answer.

For the annotations. First, read the documentation I wrote inside the class:
https://github.com/muuki88/e4GeminiJPA/blob/master/de.mukis.gemini.sample.rcp/src/de/mukis/gemini/sample/rcp/handlers/SavePersonPreferencesHandler2.java

Furthermore I recommend to read http://www.vogella.com/articles/Eclipse4Preferences/article.html (more over all articels on vogella.com)

Using plain Gemini JPA try something like this:
https://github.com/knowing/Medmon/blob/master/de.lmu.ifi.dbs.medmon.medic.core/src/de/lmu/ifi/dbs/medmon/medic/core/service/EntityManagerService.java

This is a very simple implementation of how to bind EntityManagerFactoryBuilders, which are the key to create custom EntityManagerFactories.
Take a look inside the gemini.ext.di implementation
https://github.com/muuki88/org.eclipse.gemini.ext.di/blob/master/org.eclipse.gemini.ext.di/src/main/java/org/eclipse/gemini/ext/di/impl/GeminiEMFSupplier.java
https://github.com/muuki88/org.eclipse.gemini.ext.di/blob/master/org.eclipse.gemini.ext.di/src/main/java/org/eclipse/gemini/ext/di/impl/GeminiEMSupplier.java

which is a bit more sophisticated,
Muki
Re: Gemini JPA: Getting Started? [message #1067143 is a reply to message #1066990] Sat, 06 July 2013 07:14 Go to previous messageGo to next message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
Hi there,

I created a kepler branch on my sample application which works smooth with the current Kepler release. Can you try it?

cheers,
Muki
Re: Gemini JPA: Getting Started? [message #1067154 is a reply to message #1061965] Sat, 06 July 2013 14:05 Go to previous message
Nepomuk Seiler is currently offline Nepomuk Seiler
Messages: 88
Registered: December 2010
Member
The kepler branch is now merged into the master and has a working build. The gemini.ext.di bundle was also updated to work with the current kepler release.
Previous Topic:Gemini Jpa: Cannot use JavaLog with EclipseLink
Next Topic:Blueprint missing @ServiceReference annotation
Goto Forum:
  


Current Time: Wed Jul 23 10:01:45 EDT 2014

Powered by FUDForum. Page generated in 0.03694 seconds