ObjectNotFoundException on migration from spring 1.2.8 to 2.0.2
Hi. My web application works fine with spring 1.2.8 and hibernate 3.1.3.
When I upgrade to spring 2.0.2 and hibernate 3.2.1.ga (just update jars with maven2), I got ObjectNotFoundException when i load profile object after update it.
Profile class has one-to-many relationship with Permission class. The database is updated right, but hibernate throws exception about permission of the profile when i try to load profile from database!
What is wrong? I look forward your answer and thanks in advance!
I would have thought this is related to Hibernate rather than Spring. The exception says it can't find a specific item in the database e.g. Permission 735. I know it might be a stupid question, but does this item actually exist?
When hibernate update profile object, old permissions are deleted and new permissions are created at the database. It seems cache problem, because when i try to load the profile again, hibernate try to load old permissions, thatīs the error ObjectNotFoundException.
When i restart the application, updated profile object references new permissions and hibernate loads ok!
I didnīt change any code, just hibernate and springframework jars!
Any suggestions?
I would first turn caching off, just to take that out of the equation. Is it possible to see the code that is causing the error? It would be good if you could give me a step-by-step description of how you get the error, or a test case.
I turn caching off and it works! Well, now we know where the problem is with caching!
Let me post a stey-by-step description when the cache is on:
1 - using the web app (myfaces + spring + hibernate), I access the page to update a profile bean. I set new permissions and submit the page. It works ok and the profile bean has new permissions (profile table and permission table are updated ok).
2 - i access another page to list profile. the page reloads all profiles, including the updated profile. Here, there is no problem because the permissions are not loaded yet.
3 - when i try to access the profile view page, the error occurs!
Iīm posting the code of remaining classes and spring transaction configuration. I cut the classes and xml because upload size file limit, but the method name are preserved!
Is there any new cache parameter to set or any new behaviour?
The problem is with hibernate 3.2.1ga !!!
I tested with hibernate 3.2.0ga and hibernate 3.2.2 ga (recently released) and it works!
There was no problem with spring! I could upgrade fine!
Thanks in advance!
Just some tries:
I tried to upgrade spring 1.2.8 to 2.0.2 first. It worked!
After, I tried to upgrade hibernate 3.1.3 to 3.2.0.ga and it worked too! When I tried to upgrade to 3.2.1.ga, it failed. Today, when i visited hibernate home page, i saw 3.2.2.ga release (not at maven repository yet!). I downloaded it, tested and it worked!