File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Using JPA in Java SE environment. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Using JPA in Java SE environment." Watch "Using JPA in Java SE environment." New topic

Using JPA in Java SE environment.

Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 98
Hi ,
I want develop a simple desktop application. For that i want use JPA to handle the persistance logic.
What are the jar files i need to download ( means where the implementation for JPA spec is available)
Is the Hibernate 3.0 an implementation for JPA specification ?.

Just give me simple steps to wirte a simple java program to store an entity ( at least give me the url where the example available, i have googled for the same and most of them are in J2EE environment, but i need in J2SE)

thanks in advance,

Douglas Graham

Joined: Jul 06, 2009
Posts: 10
The Sun Web site is an amazing place. I found this by googling "jpa desktop applications", Using the Java Persistence API in Desktop Applications.

If you don't do data, you don't do diddly!
Manuel Alberto Quero
Ranch Hand

Joined: Jul 17, 2009
Posts: 31
Hello Bala,

It is possible to use Hibernate as JPA implementation in a J2SE environment.

In order to use Hibernate in a J2SE environment basically you have to configure some parameters (transaction-type="RESOURCE_LOCAL") since you cannot use connection pools and other resources from J2EE application servers.

You can find detailed information in Hibernate documentation:

(Go to the sentence "Here is a typical configuration in a J2SE environment" :wink

The way you use Hibernate from your J2SE application is exactly the same as you do from any J2EE application so you can follow any Hibernate example.


Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 98
Thanks for the reply.
I agree. Here's the link:
subject: Using JPA in Java SE environment.
It's not a secret anymore!