-->
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: HibernateUtil - HiA or CaveatEmptor - which one to use?
PostPosted: Thu May 18, 2006 5:22 pm 
Beginner
Beginner

Joined: Thu May 18, 2006 2:58 pm
Posts: 28
There is the example in the HiA book for implementing HibernateUtil (Listing 8.3) and using the doFilter (listing 8.4) and then there is the example in CaveatEmptor.

I'm assuming the CaveatEmptor example is more robust?

Can the book example be used in production?

Any suggestions/comments on which one to go with?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 2:08 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://hibernate.org/42.html
http://hibernate.org/43.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 11:06 am 
Beginner
Beginner

Joined: Thu May 18, 2006 2:58 pm
Posts: 28
So the note in http://hibernate.org/42.html...stating that Every other HibernateUtil is obsolete for Hibernate 3.1. pertains to the HIA thread-local example (listing 8.3) too?

Does enabling the thread-bound strategy (see below) in your Hibernate configuration solve the same problem the thread-local HIA HibernateUtil was solving?

Quote:
To enable the thread-bound strategy in your Hibernate configuration:

set hibernate.transaction.factory_class to org.hibernate.transaction.JDBCTransactionFactory
set hibernate.current_session_context_class to thread


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 11:11 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Every means all.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 10, 2006 9:17 pm 
Regular
Regular

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

Can you advise if can I use the HibernateUtil.java in caveatemptor-0.9.5 which implements filter and use JPA EntityManager to replace the Hibernate Session?

Basically I was using the HibernateUtil.java in caveatemptor-0.9.5, I can use it fine with Hibernate 3.2.cr2. When I discover more, I came across JPA and understand Hibernate actually implements JPA. So, I would like to know how should I write my HibernateUtil.java in order to use JPA that implements through Hibernate.

Hope you can advise me so that I can kick start on this.

Please advise.
Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 2:56 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
HibernateUtil is for Hibernate. Use the version on http://hibernate.org/42.html

For JPA you can use a JPAUtil class that holds the EntityManagerFactory, just like HibernateUtil holds the SessionFactory. That is the only purpose of such a *Util class, don't do anything else in there.

Ignore CaveatEmptor alpha stuff if you don't know the basics, it's not supposed to be understood without a book.


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.