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 Hibernate JPA and JTA on J2SE platform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate JPA and JTA on J2SE platform" Watch "Hibernate JPA and JTA on J2SE platform" New topic

Hibernate JPA and JTA on J2SE platform

Treimin Clark
Ranch Hand

Joined: Nov 12, 2008
Posts: 757
In theory, we say that we can't use JTA and JPA (javax.persistence) on a J2SE annotation. It is reserved only for J2EE. Is that really true? What if we are using Hibernate on a AWT desktop application? There are two libraries named "Hibernate JPA", and "Hibernate JTA". We can use those J2EE classes on our J2SE desktop application?
Oh, there is an javax.persistence.EntityManager class too. Does it mean that we can use JPA on Hibernate, or it just something like JPA-simulated hibernate?

I'm new to Hibernate, therefore please kindly answer.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Take a look at some of the introductory Hibernate tutorials that you can get to from my signature links.

You'll notice that all of the initial examples use JPA annotations, and all of them run from a J2SE application with a main method, and all of those stand-alone J2SE applications start and end their own transactions. None of the examples run within a J2EE container at all.

So, if you want to use the J2EE containers implementation of the Java Transaction API, then you need a J2EE container. But Hibernate provides facilities for coordinating XA compliant transactions without the use of a J2EE container whatsoever.

Does that make any sense?

Hibernate and Transcations from a Stand-Alone J2SE Application (not J2EE/JEE5)


-Cameron McKenzie
I agree. Here's the link:
subject: Hibernate JPA and JTA on J2SE platform
It's not a secret anymore!