You don't need any of those silly "Servlet Engines" or overrated "Application Servers" to work with JPA. All you need is a persistence provider; that is, someone who knows how to process JPA stuff, and you're good.
Hibernate is probably the most popular JPA implementation framework. Here's a little class that I can annotate with JPA tags, and pass into the Hibernate Session/EntityManager, and have it persist my data to a database:
As you can see, that's all done in a main method - that is, it's done in a standalone Java application that runs on nothing more than a Java 5 JRE. No EJB or Servlet containers are harmed in the running of this code.
So, in summary, you do not need a J2EE / JEE5 container in order to work with the Java Persistence API.
Joined: Aug 07, 2008
Thanks mate ,awesome reply ,was like a beautiful sun ray tearing the dark clouds away .
The link was quite useful too . Just as you did I added a main method in my Cabin class and it works like a charm .