-->
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 id with autocommit
PostPosted: Wed Jul 26, 2006 9:05 pm 
Newbie

Joined: Fri Jun 16, 2006 12:24 pm
Posts: 7
I have a test case where I save an object and then check to see if the id is set to a valid value.

If I have hibernate.connection.autocommit=false, then I get the next value in the sequence for the primary key but the object is not persisted to the database.

If I have hibernate.connection.autocommit=true, then the id is set to "0" but the object is persisted to the database.

I'm using db2 on a mainframe for the database. Has anyone else experienced this?

-Mike


Top
 Profile  
 
 Post subject: DB2 not commiting.
PostPosted: Tue Aug 29, 2006 8:35 am 
Newbie

Joined: Wed Aug 23, 2006 9:04 pm
Posts: 1
Location: Citizen of the world
Hello,

I've been experiencing the same problem as you describe.
I've reviewed all postings here and found that the DB2OS390 dialect would require the autocommit to false for the correct retrieval of the next value.

All objects and its collections are being inserted and updated but never actually commited into the tables.

Configuration is DB2 v7.1, JDBC Type2, Hibernate 3.x and using the OS390 dialect.

Has anyone experienced a similar problem? and if it can provide any pointers would be greately appreciated.

Finally on side testing we've confirmed the same code works fine on DB2Dialect (not os390) on a DB2 UDB 8.x on Windows.

Thanks !


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 31, 2006 11:36 am 
Newbie

Joined: Fri Jun 16, 2006 12:24 pm
Posts: 7
Thanks for the reply! At least I feel a little more comfortable knowing others are still having this same problem. We've found a sort of work around for this. We are using spring with hibernate and we are using the hibernateTemplate that spring provides via extending HibernateDaoSupport. We are also using spring transactions. If we wrap all the daos in a transaction, then everything seems to work fine.

I can't say I understand why this works since hibernateTemplate should be able to figure out when to start/end a transaction, but if you use TransactionProxyFactoryBean then it runs the whole process in the same transaction and everything works.



hope this helps


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.