-->
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.  [ 9 posts ] 
Author Message
 Post subject: JTA, JBoss and rollback
PostPosted: Tue Jun 08, 2004 9:02 am 
Newbie

Joined: Thu Dec 18, 2003 12:50 pm
Posts: 8
Location: FRANCE
Hi all,

I have managed to integrate Hibernate as a Jboss service and it rocks. My underlying database is mySQL. But, I have a problem : I can't rollback.

When I rollback by calling the rollback method on my current transaction, nothing happens. Objects that were created are not removed from the database. I don't understand what's happening and my system ends up in an unstable state since the database does not reflect the rollback. For short, everything happens as if the autocommit mode is turned on.

Regards.

_________________
Olivier.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 9:12 am 
Senior
Senior

Joined: Wed Aug 27, 2003 4:08 am
Posts: 178
Location: Wiesbaden, Germany
well, did it happened to you that autocommit mode is just turned on?
AFAIR, jboss datasources and hibernate suffer from this problem.

dig into mysql docs, there is information how to turni it off through parameter in connection string.

_________________
Got new hibernate xdoclet plugin? http://www.sourceforge.net/projects/xdoclet-plugins/
... Momentan auf der Suche nach neuen Projekt ode Festanstellung....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 9:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Are you using InnoDB tables (you should)?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 9:30 am 
Newbie

Joined: Thu Dec 18, 2003 12:50 pm
Posts: 8
Location: FRANCE
Well I don't whether and how to turn off the autocommit mode, but I'm quite sure something like that is happening. Data are written to persistent storage before the transaction ends. And I don't think hibernate issue sql commands to compensate.

As far a I understand, it is a problem with mySQL.

Regards.

_________________
Olivier.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 9:38 am 
Newbie

Joined: Thu Dec 18, 2003 12:50 pm
Posts: 8
Location: FRANCE
michael wrote:
Are you using InnoDB tables (you should)?


Sorry, but my knowledge of mySQL is poor. How can I check whether these tables are InnoDB tables?

_________________
Olivier.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 9:50 am 
Newbie

Joined: Thu Dec 18, 2003 12:50 pm
Posts: 8
Location: FRANCE
michael wrote:
Are you using InnoDB tables (you should)?


My tables are of type MyISAM. And I can do little against that as my tables are generated using hibernator the Eclipse plugin.

_________________
Olivier.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 10:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
MyISAM Tables do not support transactions


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 2:57 pm 
Expert
Expert

Joined: Thu Jan 08, 2004 6:17 pm
Posts: 278
orichaud wrote:
michael wrote:
Are you using InnoDB tables (you should)?


My tables are of type MyISAM. And I can do little against that as my tables are generated using hibernator the Eclipse plugin.


You must add the following to your MySQL.ini:

[mysqld]
...
default-table-type=InnoDB

This will make all your tables be InnoDB no matter who generates them, which is what you want if you want your tables to be transactional.

If you are on Linux I do not know how you set the default table type.

Cheers,
Rob


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 7:02 pm 
Newbie

Joined: Thu Dec 18, 2003 12:50 pm
Posts: 8
Location: FRANCE
Thanks it works ! I can now create InnoDB tables.

Problem : now I'm having problems with foreign keys when deleting an object. mySQL refuses to commit and Hibernate throws the following exception :
Code:
net.sf.hibernate.JDBCException: Could not synchronize database state with session: General error, message from server: "Cannot delete or update a parent row: a foreign key constraint fails".


The foreign keys is generated by hibernate to handle binary associations.

I've posted http://forum.hibernate.org/viewtopic.php?t=931640

RobJellinghaus wrote:
orichaud wrote:
michael wrote:
Are you using InnoDB tables (you should)?


My tables are of type MyISAM. And I can do little against that as my tables are generated using hibernator the Eclipse plugin.


You must add the following to your MySQL.ini:

[mysqld]
...
default-table-type=InnoDB

This will make all your tables be InnoDB no matter who generates them, which is what you want if you want your tables to be transactional.

If you are on Linux I do not know how you set the default table type.

Cheers,
Rob
[url][/url]

_________________
Olivier.


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