Hi,
I have created a Dashboard in my application. This is suppose to query database at regular intervals and populate data in the grids in the dashboard.
My application is using session factory. That is one session per node.
Now when i created initially created the dashboard, I was using the same session to fetch data from the database. But it was later identified that the data being shown is stale. It was fetching data from the hibernate cache. Only new rows were properly fetched and deleted rows were eliminated but the same primary key rows details were coming from cache resulting in stale data when such rows are updated from other nodes or from back-end.
After doing some research, i found that to fetch fresh data always i will have to use new sessions. I did that using openSession() and fresh data is being fetched now. But there is only one problem, when this session is opened, it creates a new database session which is not closed after session.close() as well. After session.close(), if i check session.isConnected(), it returns false. But the database session still exist.
This is pretty urgent, i have already missed my deadline because of this.
Thanking in advance,
Ali.
I have created a Dashboard in my application. This is suppose to query database at regular intervals and populate data in the grids in the dashboard.
My application is using session factory. That is one session per node.
Now when i created initially created the dashboard, I was using the same session to fetch data from the database. But it was later identified that the data being shown is stale. It was fetching data from the hibernate cache. Only new rows were properly fetched and deleted rows were eliminated but the same primary key rows details were coming from cache resulting in stale data when such rows are updated from other nodes or from back-end.
After doing some research, i found that to fetch fresh data always i will have to use new sessions. I did that using openSession() and fresh data is being fetched now. But there is only one problem, when this session is opened, it creates a new database session which is not closed after session.close() as well. After session.close(), if i check session.isConnected(), it returns false. But the database session still exist.
This is pretty urgent, i have already missed my deadline because of this.
Thanking in advance,
Ali.