Gemini JPA: Getting Started? [message #1061965] |
Wed, 05 June 2013 03:42  |
Eclipse User |
|
|
|
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 #1063392 is a reply to message #1063198] |
Thu, 13 June 2013 01:17   |
Eclipse User |
|
|
|
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 #1065675 is a reply to message #1061965] |
Thu, 27 June 2013 02:05   |
Eclipse User |
|
|
|
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] by Moderator
|
|
|
|
|
|
|
|
|
|
Re: Gemini JPA: Getting Started? [message #1066720 is a reply to message #1066707] |
Thu, 04 July 2013 01:22   |
Eclipse User |
|
|
|
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] by Moderator
|
|
|
|
|
|
|
|