Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: ObjectNotFoundException on migration from spring 1.2.8 to 2.0.2

  1. #1
    Join Date
    Jul 2005
    Location
    salvador bahia brazil
    Posts
    12

    Default 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!

    obs. iīm using ehcache

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Its hard to know what the problem is without seeing the stacktrace.

  3. #3
    Join Date
    Jul 2005
    Location
    salvador bahia brazil
    Posts
    12

    Default

    Hello,

    Follows the stacktrace and pojos and hbms.
    Attached Files Attached Files
    īs marcelo

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    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?

  5. #5
    Join Date
    Jul 2005
    Location
    salvador bahia brazil
    Posts
    12

    Default

    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?
    īs marcelo

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    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.

  7. #7
    Join Date
    Jul 2005
    Location
    salvador bahia brazil
    Posts
    12

    Default

    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?

    Thanks in advance!
    Attached Files Attached Files
    īs marcelo

  8. #8
    Join Date
    Jul 2005
    Location
    salvador bahia brazil
    Posts
    12

    Default

    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!
    īs marcelo

  9. #9
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Mmmmm interesting. Did you find a bug report that pointed you to this solution, or did you just try it?

  10. #10
    Join Date
    Jul 2005
    Location
    salvador bahia brazil
    Posts
    12

    Default

    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!
    īs marcelo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •