Hi,
We are trying to implementing Hibernate Custom Fields with spring + Hibernate
With the support of some documents available on custom Fields approach, we are able to create a custom field properly and can able to see added custom field to database but we are not able to add the data to the newly added custom Field. This might be because of Hibernate first level cache not being updated with updated database schema?
When we are trying to add data to the domain object including to the newly added custom Fields, the data that was inserted to database properly except to the newly added custom field, its storing value NULL to the newly added field. Seems, this is valid issue, as Session will not aware of the updated Database schema?
When we tried adding the data after restarting the servers, I was able to see that data is properly inserted even to newly added custom Field. To achieve this with out restarting server, we tried to reload the session factory bean and trying to use the reloaded session factory bean for all operations then it’s started working but we are facing with 2 issues.
- Connection that are opened in old session are still in sleeping state and Connections are keeps on increasing each time when we add a custom field.
- And application is getting struck as most of the sql commands to database are getting suspended. (This might be because of the connections leakage issue, listed above?)
Is there any way, we can reload the session factory and the first level cache with updated database schema.
For some references to implementation,
We are using Spring2.5.6,
Hibernate3.2
Database - sqlserver2005
Please let me know if you need any other details.
Thanks,
Mohan
|