-->
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: Transaction Doesn't Rollback
PostPosted: Fri Jul 28, 2006 8:00 pm 
Newbie

Joined: Fri Jul 28, 2006 7:57 pm
Posts: 2
Location: Denver
The following code makes changes to the database, and, if I understand transactions properly, it doesn't seem like it should.

Also, this database is affected irrespective of wether session.getTransaction().rollback() is called.

Any Ieas?

Hibernate version: 3

Mapping documents: Annotations

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

session.beginTransaction();

Course c = new Course();
c.setName("Raferrrr");

session.save(c);

session.getTransaction().rollback();



Full stack trace of any exception that occurs:

Name and version of the database you are using:MySQL 4.1.20-standard

The generated SQL (show_sql=true):
Hibernate: insert into Course (name, level) values (?, ?)


Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 30, 2006 5:10 pm 
Senior
Senior

Joined: Tue Mar 09, 2004 2:38 pm
Posts: 141
Location: Lowell, MA USA
If your MySQL database is set up with the defaults, you're using MyISAM tables, which are not transactional. In order to use transactions with MySQL, you need to create your tables using the InnoDB table type.

Ryan-

_________________
Ryan J. McDonough
http://damnhandy.com

Please remember to rate!


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.