Hi,
I have a login page and once the user is logged in i will add the user object in the
servlet session.
This user table has one to many relationships with many tables. One of the table is EmploymentDetails.
One user might have more than one entry in employment table.
When the user wants to see the employment details, he will be taken to the employment details page.
So in the controller, i will do the following before taking him to the
jsp page.
Part of the code :
usersDAO.attachClean(user); // Here i am attaching the user to the hibernate session.
Set<EducationalDetails> educationDetailsSet = user.getEmploymentDetailses();
Once the user is taken to the jsp page,
if i refresh the page again, the query is not fired as the data is fetched from the Hibernate session.
But, some one else has modified the data in between directly in the table.
But these modified data are not reflected in the JSP page as it still fetch values from hibernate session.
How to prevent this?
If i need to add session.refresh(), Will it trigger the query every time when i refresh the page?
If it is so, how to improve the performance as it has to hit the DB every time?
Also, i have an add button in the screen. On clicking this user will be taken to a page wherein he can add the new employment details.
On submitting the page, the user will agin taken back to the Employment details page. But unable to see the newly added records.
Thanks,
Baskar.S