-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate and Spring
PostPosted: Mon Jan 03, 2005 4:11 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 3:18 am
Posts: 32
Hi,
How does spring handle hibernate transactions?
How does spring make hibernate transactions easier?
What is the model that hibernate uses for handling transactions?

Thanks.
Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 5:01 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hibernate uses JDBC, JTA, or your custom transaction strategy. Ask the Spring guys for your other questions.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 12:25 pm 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
What you'll usually do in Spring is demarcate high-level declarative transactions via transactional proxies (defining a Spring TransactionProxyFactoryBean for each of your facades). In the case of Hibernate, you'll use Spring's HibernateTransactionManager as backend transaction strategy. This is similar to EJB CMT, just on plain POJOs.

Your DAOs will then automatically participate in those transactions, as long as you use Spring's HibernateTemplate (or SessionFactoryUtils) to perform your operations. DAOs will just contain the actual operation code; there won't be any transaction checks or the like in there. Such DAO method implementations are often one-liners!

Have a look at the Petclinic sample application that comes with the Spring distribution. It comes with a Hibernate-based data access layer by default, showing all of the above in action in an end-to-end application.

Juergen


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