JPA Configuration without persistance.xml

#1

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

#2

When using ObjectDB the persistence.xml is file optional.

Just annotate the classes and use them.

ObjectDB Support
#3

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

Reply