Sorry for the delay in reply, as I was not working on this issue for quite sometime.
I tried a number of work-arounds for the previous code, but to no success. So I have got back to the conventional way of using saveOrUpdate, as follows:
Session session = this.getSession();
session.beginTransaction();
session.load(VulTable.class, transientInstance.getId());
session.saveOrUpdate(transientInstance);
session.getTransaction().commit();
But still I have the same problem, ie after 2/3 updates, the data fetched is not the latest.
I think it has got to do with the hibernate session, which does not always gets updated (or stops updating after few updates are made continuously).
Also there's another thing which I have noticed. I performed a small
test. Just after the transaction is committed, and I try to fetch the data using the id(using findById function in the DAO), I get the appropriate data.
[I call the findById function from the saveOrUpdate function of the DAO itself, after the transaction is committed.]
But, when I try to fetch the data from the Action class of the UI, using the same findById function of the DAO, I dont always get to see the latest data.
Also, I have tried with both
JDBC and JTA transaction, but have the same problem.
Please suggest.
==================
Devesh Chanchlani
==================
"The best ammunition is a load of ambition fired with effort towards a definite goal."