-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: EJB3 JPA
PostPosted: Tue May 30, 2006 5:00 am 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
I'm trying to learn Hibernate core at the moment and I came across "JPA" (Java Persisitence API) lately and understand that it's available from the Java EE.

I would like to seek some clarification here.

1. It's called EJB3 JPA, so does it mean we have to implement EJB in our application in order to use this JPA thing?

2. Can this EJB3 JPA generate SQL to multiple dialect like Hibernate?

3. Is this JPA an alternative to Hibernate cos I read somewhere saying that it combines the best from a few of the OR mapping framework? If not, why?

4. Why should we use Hibernate as compared to this EJB3 JPA?

Please advise.
Thank you.


Top
 Profile  
 
 Post subject: Re: EJB3 JPA
PostPosted: Tue May 30, 2006 7:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
jbchurn wrote:
I'm trying to learn Hibernate core at the moment and I came across "JPA" (Java Persisitence API) lately and understand that it's available from the Java EE.

I would like to seek some clarification here.

1. It's called EJB3 JPA, so does it mean we have to implement EJB in our application in order to use this JPA thing?


You can use JPA whereever you want.

You need to be more specific about what you mean by EJB (e.g. is it entitybeans, sessionbeans etc.) ...and in any case take a look at how
EJB3 before you choose not to use it ..it is so much better than EJB2

Quote:
2. Can this EJB3 JPA generate SQL to multiple dialect like Hibernate?


Hibernate EntityManager can.

Quote:
3. Is this JPA an alternative to Hibernate cos I read somewhere saying that it combines the best from a few of the OR mapping framework? If not, why?
[/qutoe]

Hibernate EntityManager is an *implementation* of the JPA spec so it is a way to get a standardized interface to Hibernate.

Quote:
4. Why should we use Hibernate as compared to this EJB3 JPA?


hibernate has more features than JPA; but you can still use hibernate together with JPA getting standard API and then only in the case of something special use hibernate API.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 9:35 am 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Hi Max,

Sorry if my question below sounds weird, just trying to get the correct understanding based on some of things I read.

1. You mention we can use JPA whenever we want, does that mean we can use JPA without using Toplink or Hibernate?

2. When we say A is an "implementation" or "reference implementation", that means A is something that built on top of the JPA, such as Toplink Essential. Is there correct?

3. Do I understand correctly that JPA itself does not know how to generate to multiple database dialect SQL? It's the product such as Toplink or Hibernate that build on top of JPA that makes it able to generate SQL for various database dialect. And the type of support database dialect is again depends toplink or hibernate has to offer. Correct?

4. Toplink Essential is the reference implementation for EJB3 JPA (correct me if i'm wrong). So, for Hibernate side, is Hibernate EntityManager the same category of component as Toplink Essential?

5. Is "EJB3 JPA" different from "JPA"? Must we implement EJB if we want to use JPA?

Please advise.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 9:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
jbchurn wrote:
1. You mention we can use JPA whenever we want, does that mean we can use JPA without using Toplink or Hibernate?


You need *some* implementation of JPA, but it is not tied to an J2EE server.

Quote:
2. When we say A is an "implementation" or "reference implementation", that means A is something that built on top of the JPA, such as Toplink Essential. Is there correct?


no. It is not build *on top* of JPA it is an *implementation* of the JPA specification. Hibernate EntityManager and Toplink essentials is such things.

Quote:
3. Do I understand correctly that JPA itself does not know how to generate to multiple database dialect SQL? It's the product such as Toplink or Hibernate that build on top of JPA that makes it able to generate SQL for various database dialect. And the type of support database dialect is again depends toplink or hibernate has to offer. Correct?


JPA is a *specification* not an *implementation* it does not care about what sql is generated, that is the *implementation*.

Quote:
4. Toplink Essential is the reference implementation for EJB3 JPA (correct me if i'm wrong). So, for Hibernate side, is Hibernate EntityManager the same category of component as Toplink Essential?


yes

Quote:
5. Is "EJB3 JPA" different from "JPA"? Must we implement EJB if we want to use JPA?


same answer that before. What do you mean by "implement EJB" and have you looked at what EJB actually means in EJB3. In any case, if you by EJB mean: "am I required to use a full appserver" then no you don't.

And you don't need session beans (but they are definitly recommended), you just need entity beans (which is just POJO's in EJB3)

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 12:12 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
max wrote:
Quote:
4. Toplink Essential is the reference implementation for EJB3 JPA (correct me if i'm wrong). So, for Hibernate side, is Hibernate EntityManager the same category of component as Toplink Essential?


yes


Actually no, Hibernate EntityManager should be compared to the full featured Toplink. Toplink Essential is a subset of Toplink and can't compete against Hibernate EntityManager

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 12:44 am 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Why is it named as "EJB3 JPA" and not just JPA?


To me, "EJB3 JPA" sounds like it's a "JPA for EJB3", but EJB3 itself is also a specification right? not something that implements JPA right? :P


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.