-->
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.  [ 2 posts ] 
Author Message
 Post subject: Question about Hibernate, Annotation and JPA
PostPosted: Mon Oct 25, 2010 10:41 am 
Newbie

Joined: Thu Aug 27, 2009 10:35 am
Posts: 6
Hello all,
Im learning Hibernate and have a very simple question. what's the relationship between Hibernate and JPA?
In my opinion,
"pure" hibernate use XML metadata and hibernate native API, they are strong but not obey EJB3 specification.
"pure" EJB3 use JPA Annotation (or JPA XML metadata), and JPA API, but they can only be used in an EJB3 Application Server like JBoss, but not like Tomcat.

I found a project which base on Spring Framework and Tomcat, in my opinion Spring Framework is an alternative to EJB3, so they use certainly Hibernate API but why use they JPA Annotation too?

Is the JPA Annotation not a part of EJB3? Can I just use it outside the EJB3 AppServer? How do you work with Hibernation in your projects?

thanks


Top
 Profile  
 
 Post subject: Re: Question about Hibernate, Annotation and JPA
PostPosted: Mon Oct 25, 2010 10:58 am 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
> Im learning Hibernate and have a very simple question. what's the relationship between Hibernate and JPA?

Hibernate could be used as JPA implementation. JPA itself is just a specification (bundle of interfaces mostly) that does not work without an implementation.

> "pure" hibernate use XML metadata and hibernate native API, they are strong but not obey EJB3 specification.

That is not technically correct. You can use JPA annotations with pure Hibernate too.

> "pure" EJB3 use JPA Annotation (or JPA XML metadata), and JPA API, but they can only be used in an EJB3 Application Server like JBoss, but not like Tomcat.

That is not correct either. JBoss is EJB3 implementation in a similar way as Hibernate is JPA implementation.

> I found a project which base on Spring Framework and Tomcat, in my opinion Spring Framework is an alternative to EJB3, so they use certainly Hibernate API but why use they JPA Annotation too?

That is correct. Spring is an alternative to EJB3. They, however, try to get as many users as possible, so they try to provide kind of "integration" wrappers to every framework in the world. If you have a choice I would suggest to stay away from this messy non-standard nightmare what Spring Framework became.

> Is the JPA Annotation not a part of EJB3?

JPA annotations are part of EJB3 as these are replacement of EJB2 entity beans.

> Can I just use it outside the EJB3 AppServer?

Yes, you can. Check out Hibernate JPA annotations.

> How do you work with Hibernation in your projects?

It is Hibernate, not HibernatION. In one of my latest projects I use standalone Hibernate with annotation. It is extremely nice to use. Try it our yourself.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.