JPA Query
posted 16 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi ,
I am of the view that JPA may be used for standalone applications (i.e. even without a server(web/application)),
dragged along by this belief I ventured along to make an application
I made an entity class :Cabin
and a client class: StandaloneClient
also I have persistence.xml within META-INF in my classpath
and all I get is a Fat exception :
Is it possible to use JPA the way I want to use it . If yes ,how do we get over this exception( does any one have the postal address for the Persistence provider
) .
Thanks everyone for helping out
I am of the view that JPA may be used for standalone applications (i.e. even without a server(web/application)),
dragged along by this belief I ventured along to make an application
I made an entity class :Cabin
and a client class: StandaloneClient
also I have persistence.xml within META-INF in my classpath
and all I get is a Fat exception :
Is it possible to use JPA the way I want to use it . If yes ,how do we get over this exception( does any one have the postal address for the Persistence provider
) . Thanks everyone for helping out

SCJP5 ,SCWCD5
posted 16 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
Here's a little tutorial in which I detail how to set up this particular configuration with Hibernate and run the code. There's nothing to it, actually:
Using the Java Persistence API (JPA) in a Stand-Alone Java Application (no containers!)
So, in summary, you do not need a J2EE / JEE5 container in order to work with the Java Persistence API.
Regards,
-Cameron McKenzie
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.
Here's a little tutorial in which I detail how to set up this particular configuration with Hibernate and run the code. There's nothing to it, actually:
Using the Java Persistence API (JPA) in a Stand-Alone Java Application (no containers!)
So, in summary, you do not need a J2EE / JEE5 container in order to work with the Java Persistence API.
Regards,
-Cameron McKenzie
Abhijit Rai
Ranch Hand
Posts: 41
posted 16 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hey Cameron,
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 .
Also the Hibernate configuration xml looks like :
Thanks again ,
Cheers
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 .
Also the Hibernate configuration xml looks like :
Thanks again ,
CheersSCJP5 ,SCWCD5
| Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |








