-->
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: Hibernate session problem with Tomcat5.5.xx + MySQL5.x
PostPosted: Wed May 14, 2008 6:35 am 
Newbie

Joined: Wed May 14, 2008 6:06 am
Posts: 1
Application Server:Tomcat 5.5.20 on WindowsXP/Debian Etch
Hibernate version: 3.0.x
Database version: MySQL 5.0.32-Debian_7etch5-log and 5.0.51b-community-nt

Hi,

I got a problem with hibernate 3 and mysql 5,

[when I select, I get 2 datas]
Hibernate:
select
this_.FolderId as FolderId15_0_,
this_.Name as Name15_0_,
this_.Type as Type15_0_,
this_.Created as Created15_0_,
this_.ParentId as ParentId15_0_
from
dashboardfolder this_
where
this_.ParentId=?
folder size= 2 <--- [I count the data and print it]

[Next, i do some inserting]
Hibernate:
insert
into
folder
(Name, Type, Created, ParentId)
values
(?, ?, ?, ?)

[I have check the data in database, the data inserted successfully, however when i select again...]
Hibernate:
select
this_.FolderId as FolderId15_0_,
this_.Name as Name15_0_,
this_.Type as Type15_0_,
this_.Created as Created15_0_,
this_.ParentId as ParentId15_0_
from
dashboardfolder this_
where
this_.ParentId=?
folder size= 2 <--- [I still got only 2 datas, meanwhile I expect it to be 3]

[After i restart my tomcat]
Hibernate:
select
this_.FolderId as FolderId15_0_,
this_.Name as Name15_0_,
this_.Type as Type15_0_,
this_.Created as Created15_0_,
this_.ParentId as ParentId15_0_
from
dashboardfolder this_
where
this_.ParentId=?
folder size= 3 <-- [I got 3 datas]

I don't want to restart my tomcat everytime I add data, flushing the session didn't help either.

It didnt seem to matter which platform we were on, it consistently had same problem on windows or debian etch. We also tried setting tx_isolation=READ-COMMITTED on mysql but it didnt seem to help.

We used to run the application on tomcat5+SQLServer2000 and we never had this problem, so it looks like a MySQL related issue.

Just wondering if anyone have encountered similar problem?

Thanks
azhan


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 14, 2008 9:49 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
How often are you committing the transaction?

Some platforms automatically commit the transaction, and close the database connection for you. Perhaps you're not doing this in your code - SQLServer was doing this for you, but MySQL isn't. Is that possible?

It really just seems like the transaction isn't being comitted.

-Cameron McKenzie

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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.