100 words

JPA Configuration without persistance.xml

#1
2012-11-15 09:16

Hi,

 

I've been using Hibernate with JPA, and found it too slow, so am moving my project to use ObjectDB. My Jar is being held inside another application, so I don't want to have to rely on a persistance.xml file being in a particular place. When using Hibernate, I was able to do the following:

org.hibernate.cfg.AnnotationConfiguration config  = new AnnotationConfiguration();
config.addAnnotatedClass(mypackage.MyClass.class);
org.hibernate.SessionFactory factory = config.buildSessionFactory();

Is it possible to do the equivalent thing with ObjectDB?

 

Thanks very much,

Phil

obiphil
obiphil's picture
Joined on 2012-11-15
User Post #1
#2
2012-11-15 09:42

When using ObjectDB the persistence.xml is file optional.

Just annotate the classes and use them.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,332
#3
2012-11-15 09:51

Thanks very much, I read on:

http://www.objectdb.com/java/jpa/entity/persistence-unit#Managed_Persistable_Classes

And wasn't sure.

 

I appreciate the quick reply!

Phil

obiphil
obiphil's picture
Joined on 2012-11-15
User Post #2

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel