Hy guys,
I use Hibernate with Spring management of transactions. Pojos and home classes generated with Hibernate Tools.
I would like to make that :
1. Begin transaction
2. Create data in DB (in fact in transaction)
3. Read data created/existing in transaction and in DB
4. Rollback the transaction
The goal is to emulate the running of a process of my application (for example to verify if it works well). After the step 4 the database has to be unchanged (like before step 1).
In the transaction I use home classes and also HQL queries and create data, read data, eventually delete data.
It seems that when I read data in transaction (step 3) I can effectively find some data but not some other, I will explain in the following...
So in step 2 I write data, A and B are 2 tables with a many-to-many relation linking them. In step 3 I read data, I use an HQL query to find A instances which have been written in step 2, followed by a A.getB() to get B instances. But my problem is that A.getB() returns nothing (nothing is an empty array).
Whereas when I make a true "commit" between step 2 and step 3 everithing works well, but it's not a good solution for me because it's no more a fictive process when there were a commit...
So, can somebody say me if it is a cache problem. If yes what could I do to solve it ? If no, what could it be or what could I do ?
Last edited by ahuut on Mon Feb 18, 2008 12:14 pm, edited 1 time in total.
|