-->
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.  [ 2 posts ] 
Author Message
 Post subject: Reset id after rollback. Simple test fails
PostPosted: Thu Dec 08, 2005 4:30 pm 
Newbie

Joined: Sat Nov 05, 2005 5:16 pm
Posts: 2
Hibernate version: 2.1.8

This simple junit test fails.

Code:
  Session session = PersistenceLocator.currentSession();
  Transaction transaction = session.beginTransaction();
  MyObject obj = new MyObject();
  try {
    session.saveOrUpdate(obj);
    throw new Exception();
  } catch(Exception e) {
    transaction.rollback();
  }
  assertEquals(0,obj.getId());


I expected the id to be ZERO if the the transaction was rolled back.
Do you know if this is a bug or the expected behavior?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 09, 2005 12:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
depends on whether you have set "hibernate.use_identifier_rollback" to true.

The default behavior is what you see now.


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