Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Apache OpenJPA?

 
Ivan Jozsef Balazs
Rancher
Posts: 986
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has Apache OpenJPA been abandoned?

Its last version is from Nov 2013, whereas previously two versions came in every year:
OpenJPA Downloads

I thought to give Apache OpenJPA a try, even though I know it is not the reference implementation.
As I have the DB tables in my project, I generated with the tools SchemaTool and ReverseMappingTool the annotated model classes,
and wrote a test program to store a record in the database.
Now the program works fine with Java 1.6, but not with 1.7 or 1.8, where a nasty exception breaks createEntityManager, see below.
Getting stuck with 1.6 is not a compelling idea.

A sidenote: I downloaded the OpenJPA source and tried to build it under Java .17 but this error occurred:
[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.0-beta-4:create (default) on project openjpa-parent: Execution default of goal org.c
odehaus.mojo:buildnumber-maven-plugin:1.0-beta-4:create failed. NullPointerException -> [Help 1]
That might be worked around, but I do not have the nerve for it just now.

Here is the error which occurs with Java 1.7 or 1.8:

7437 [main] DEBUG org.apache.bval.jsr303.xml.ValidationParser - No META-INF/validation.xml found. Using annotation based configuration only.
Exception in thread "main" java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition for name:
"org/apache/openjpa/jdbc/identifier/DBIdentifier$DBIdentifierType"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.openjpa.jdbc.sql.DBDictionary.configureNamingRules(DBDictionary.java:519)
at org.apache.openjpa.jdbc.sql.DBDictionary.setConfiguration(DBDictionary.java:4689)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:503)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:460)
at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:204)
at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:66)
at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.calculateDBDictionary(DBDictionaryFactory.java:81)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:584)
at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1518)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:535)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:460)
at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:121)
at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:967)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:958)
at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:643)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
at hu.gsmprotect.obufleet.process.Main.main(Main.java:19)
 
Ivan Jozsef Balazs
Rancher
Posts: 986
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update: this portion in the documentation on Building OpenJPA is not very encouraging either:

Note - OpenJDK and Java SE 7 are not supported at this time.
 
Ivan Jozsef Balazs
Rancher
Posts: 986
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Upgrade: I thought I would try EclipseLink.

0) Maven dependency adjusted
1) META-INF\persistence.xml adjusted (DB access labels and provider class)
2) changing the test record's key in the source and rebuild
3) script changed by adjusting the class path
4) the test failed with a runtime error due to the missing of @Temporal annotations on the Date fields:
@Temporal(TemporalType.TIMESTAMP)
or @Temporal(TemporalType.DATE)
or @Temporal(TemporalType.TIME)
5) the missing annotations replaced by editing by hand
6) recompilation, test, success!
 
Ivan Jozsef Balazs
Rancher
Posts: 986
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do people use OpenJPA with Java 1.7 or 1.8?
 
Ivan Jozsef Balazs
Rancher
Posts: 986
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Jozsef Balazs wrote:Do people use OpenJPA with Java 1.7 or 1.8?


Well, apparently they do not.

Sigh.
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As it happens, I'm still on the developers mailing list, even though I had to make a panic migration to Hibernate JPA several years ago and haven't used OpenJPA since.

Someone opened a Jira ticket just this last Friday, but the main mailing list has been pretty quiet lately, Last serious amount of talk was Feb 25.
 
Ivan Jozsef Balazs
Rancher
Posts: 986
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info.

OpenJPA looked well, I liked it as I took the first look but it does not work for me and EclipseLink does, so the question is settled.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic