my dog learned polymorphism*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Using JPA in Java SE environment." Watch "Using JPA in Java SE environment." New topic
Author

Using JPA in Java SE environment.

Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 82
    
    1
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,
Bala



Douglas Graham
Greenhorn

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:

http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/configuration.html

(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.

Regards,

Manuel
Bala Gangadhar
Ranch Hand

Joined: Oct 07, 2008
Posts: 82
    
    1
Thanks for the reply.
 
 
subject: Using JPA in Java SE environment.
 
Similar Threads
Headstart JPA
JPA implementation ?
J2ME on Treo 650
JSF + JPA how to use together
How To Add Hibernate Facet To Eclipse Galileo JPA Project?