Announcement Announcement Module
No announcement yet.
Spring / Hibernate evict problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring / Hibernate evict problem


    I am using Spring with Hibernate and extending HibernateDaoSupport in my DAO.

    To load the object [which works fine] i use :

    (Page) getHibernateTemplate().load(Page.class, id);
    The problem lies in the fact that another application is updating the database behind this. The Page pbject loaded contrains one to many collections of Colums Which contain many ContentItems. When a change is made I am having trouble trynig to get the old content evicted / flushed, I have tried virtually everything but always get returned:

    org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException: No row with the given identifier exists
    Has anyone encountered similar problems? I am also using OSCache as the provider.


  • #2
    Could you please mention if you are loadin the collection lazily or not? If you are doing a lazy loading , then the call to load the collection will be made when it's used and that should fetch you the _fresh_ data.

    One more area to look at is the scope of the hibernate session. If you are using open session pattern then all the data is cached in your session for a request. So if the data changes while your request is 'in progess' then you will have to maunally evict the data from the hibernate session.