|
I was wondering for some advice from the pros out here. I have hibernate managed pojos in memory that are updated as needed. the process, naturally, is: i retrieve an appropriate pojo from memory, start transaction, mutate it, change some fields, etc. and then commit the transaction. however, if hibernate throws some error of some kind, the pojo ends up having stale/incorrect data. how do i handle this to ensure that the pojos always have up-to-date info?
1 solution i thought of is creating a post-commit-update, etc listener and checking if the session is dirty refreshing the pojo via session.refresh(). is this a good idea? how do i check that there was an error on this particular pojo, what do i check? session.isDirty()?
Thanks a lot for your help Lev
|