-->
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.  [ 1 post ] 
Author Message
 Post subject: Can you help me fix this transaction/hibernate session prob?
PostPosted: Thu May 28, 2009 2:37 pm 
Regular
Regular

Joined: Tue May 12, 2009 6:08 am
Posts: 92
Hi, I am having a problem using Spring's test framework with Hibernate sessions. Because of the way spring's transactions work, the tests will do things that actually DO NOT occur in the real, production environment.

For example
* Hibernate will not throw LazyInitializationExceptions when I'm testing controllers... but once in the real application, they are thrown. I want to know this before I deploy in tomcat so it just "works".
* If I forget to call a MyService.store() method, the changes are still persisted because the session is open when I run the test, whereas the session is not open in the real application
* Hibernate will not throw the error: "this object will be re-saved on cascade" in the tests... but it will in actual deployment.

Also, sometimes changes are not getting rolled back - particularly some oddball updates at various levels in the tests (controller, service or dao... and not all of them are behaving erratically - just some).

Are there any step-by-step tutorials to getting spring 2.5 and Hibernate tests working "as expected"? As in, I want my tests to behave EXACTLY like the real deployment. If not tutorials, suggestions on what is most likely happening? Besides this, everything is working 100% correct.

This problem is causing so much headache as I cannot predict if my application is going to work unless I actually test it in tomcat... and I want it to be more scientific than that. This is driving me nuts.

You can see some code samples here:
http://forum.springsource.org/showthread.php?t=72546

Thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.