-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate3 and JPA feature coverage
PostPosted: Thu Oct 19, 2006 4:34 am 
Newbie

Joined: Thu Oct 19, 2006 4:28 am
Posts: 2
Hello,

From what I understood, Hibernate3 can be used as a JPA implementation. But JPA spec seems to be a subset of Hibernate 3 features.

What features in Hib3 are missing from JPA ?
May I code 80% of my application using JPA and the remaining with Hib3 specific features ?
How do I know when I'm coding something standard (i.e. JPA) and when I'm coding sthing specific (Hib3) ?

Thank you


Top
 Profile  
 
 Post subject: Re: Hibernate3 and JPA feature coverage
PostPosted: Thu Oct 19, 2006 8:37 am 
Newbie

Joined: Wed Oct 18, 2006 11:18 am
Posts: 9
Location: Nanterre, France
viewww wrote:
What features in Hib3 are missing from JPA ?

Well, typically, the Criteria API and filters.

viewww wrote:
May I code 80% of my application using JPA and the remaining with Hib3 specific features ?

I don't see any impossibility to do so. The majority of your code will deal with javax.persistence.EntityManager, while some portion will use a org.hibernate.Session...
However, while 80% of your application will not depend on your ORM, the remaining 20% will.

viewww wrote:
How do I know when I'm coding something standard (i.e. JPA) and when I'm coding sthing specific (Hib3) ?

In order to use Hibernate's JPA implementation, you will have to use the Hibernate Annotations and Hibernate Entity Manager extensions.
When using JPA, you only deal with classes from the ""javax.persistence" package (EntityManager, etc.) and your code is indepedent from the JPA implementation.
Whenever you're using "org.hibernate" classes (Session, etc.), you're in Hibernate.

Hope this helps


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 21, 2006 11:02 am 
Senior
Senior

Joined: Tue Mar 09, 2004 2:38 pm
Posts: 141
Location: Lowell, MA USA
A simple means of accessing Hibernates Native API while using JPA is to cast the EntityManager to the HibernatEntityManager to access the Hibernate Session:

Code:
EntityManagerFactory factory = Persistence.createEntityManagerFactory("manager");
HibernateEntityManager hem = (HibernateEntityManager) factory.createEntityManager();
Session session = hem.getSession();


Ryan-

_________________
Ryan J. McDonough
http://damnhandy.com

Please remember to rate!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 21, 2006 7:22 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Or even easier, use:

Session s = (Session) em.getDelegate();


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 21, 2006 7:52 pm 
Senior
Senior

Joined: Tue Mar 09, 2004 2:38 pm
Posts: 141
Location: Lowell, MA USA
Even better! Thanks for the tip.

Ryan-

_________________
Ryan J. McDonough
http://damnhandy.com

Please remember to rate!


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