-->
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: Using HiLo Generator with Spring in a web container
PostPosted: Thu Aug 26, 2004 11:50 am 
Newbie

Joined: Mon Aug 09, 2004 10:53 am
Posts: 19
Hibernate version: 2.1

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:

Debug level Hibernate log excerpt:

Are there any problems in using HiLoGenerator with Spring in a web container?
In this document

http://www.hibernate.org/47.html

It says
"The hi/lo identifier generator built into Hibernate does not work with container managed transactions. "

Femi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 30, 2004 9:23 am 
Senior
Senior

Joined: Wed Aug 27, 2003 6:04 am
Posts: 161
Location: Linz, Austria
HiLoGenerator needs a separate JDBC Connection to fetch the "hi" value in a separate transaction. Unfortunately, this won't work in a JTA environment, where the XA-aware DataSource will always return the same JDBC Connection if a transaction is active.

This also applies to Spring-managed transactions when using JtaTransactionManager as backend strategy: You'll work with JTA underneath then, and with XA-aware DataSources fetched from JNDI, so the same restrictions apply.

However, this does not apply to Spring-managed transactions when using HibernateTransactionManager as backend strategy: Hibernate is able to fetch a new JDBC Connection for the HiLoGenerator then, while still participating in (typically declarative) Spring-managed transactions.

So, in short: This limitation only applies to JTA respectively EJB CMT, but not to Spring-managed transactions with HibernateTransactionManager.

Juergen


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 10:59 am 
Newbie

Joined: Mon Aug 09, 2004 10:53 am
Posts: 19
Thanks much


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.