Victor L
Victor L

Reputation: 10230

Can I use JPA annotations in a non-EE standalone environment?

I'd like to do some rapid prototyping with OpenJPA and I would like to use JPA annotations in my classes. I would like to run standalone (like from a main method). Can this be done?

So far I was able to run standalone but I had to use a mapping XML file that I pointed to from persistence.xml. The annotations were not being picked up automatically.

Upvotes: 1

Views: 442

Answers (1)

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340783

From official web page:

Apache OpenJPA is a Java persistence project at The Apache Software Foundation that can be used as a stand-alone POJO persistence layer or integrated into any Java EE compliant container and many other lightweight frameworks, such as Tomcat and Spring.

Check out the Getting started tutorial to find examples.

Upvotes: 2

Related Questions