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.