-->
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: Transactional TestCase of Hibernate EventListener w/Spring
PostPosted: Thu Jan 18, 2007 5:17 pm 
Newbie

Joined: Thu Jan 18, 2007 5:03 pm
Posts: 1
Hi i'm trying to use the AbstractTransactionalSpringContextTests for my test.

I 'm trying to test the right execution of the code that's in an HibernateListener, this listener implements the following interfaces:
- PostInsertEvent
- PostUpdateEvent
- PostDeleteEvent

My problem is the following:
I need that every time some kind of object is modified, some other object must be inserted in the database.

When running the code, everything goes fine...
now... when running the test case..., (that inherits from the spring class above mentioned)

for example, i insert object A with a call to save(a)
this throws the first line of the following log. Afterwards i flush the session (from the testcase) which drops the second line of this log:
Code:
Hibernate: select max(user_id) from users
Hibernate: insert into users (uri, name, status, user_id) values (?, ?, ?, ?)


Now the listener code fires up..., and between that code i execute another save, this time of object B save(b). But this just causes the following log line:
Code:
Hibernate: select max(time_id) from dbupdates


which same as before is just looking for the next sequence number, and despite flushing again the session no insert is executed

i believe that its something between the Session and the Spring abstract class which in fact is opening a transaction at beginning of testcase and closing it with a rollback at the end.

How can i solve my problem, i don't care flushing the session through the testcase, but... neither that is working for me.

thanks.
bye.


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.