-->
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: Problem with MySQL5 during load tests
PostPosted: Mon Sep 26, 2005 10:29 am 
Newbie

Joined: Mon Sep 26, 2005 10:24 am
Posts: 2
Hibernate version: 3

MySQL 5.0.12

Driver jdbc 3.1.10


Hi,

We use Hibernate 3 in a Java project, with Tomcat 5.5.9, Struts 1.2.7 and MySQL 5.0.12 (which is in a beta version).
We also use a tomcat DBCP Pool for Hibernate.

We've found a problem while we were running load tests: we use session.get() to load an object from the database. This method is expected to return null only if there no row is found in the database.

BUT, sometimes, this method does return null even though the object exist in the database. We're sure that this object exist because in all threads, we call session.get() with the same id and most of them manage to load the object.

If we loop until session.get() loads the object, it's OK but we found that a little bit strange...

If it was MySQL that was not able to accept the load, I think we would have somme exceptions like "too many connections", "try restarting transaction", "pool exhausted", etc. We also get those kind of exceptions but it's "normal".

So, I'd like to know if session.get() should not return null if and only if no row is not found in the database ?

Do you think that the problem is due to MySQL 5 (which is in beta), Hibernate, or the mapping ?

Thank you.

Note that we work with transactions. The default level in MySQL is SERIALIZATION but we got the same problem with READ COMMITTED.


This is an extract of the code :
Code:
try {
session = HibernateUtil.currentSession();
tx = session.beginTransaction();
Topic topic = (Topic) session.get(Topic.class, topicId);
if (topic==null)
{
....
}
else
{

//update the topic
....
}

tx.commit();
}
catch (HibernateException hex)
            {
            if (tx != null)
                    tx.rollback();
            }
catch (Exception ex)
            {
                if (tx != null)
                    tx.rollback();
            }
finally {
                if (session != null)
                    HibernateUtil.closeSession();
           }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 5:28 am 
Newbie

Joined: Mon Sep 26, 2005 10:24 am
Posts: 2
Please help......:(

I still have the problem. I made a program with only a main method (so no struts, no tomcat, etc) and a session.get() in a loop...
After a while, we get InvocationTargetException...


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.