2 Replies Latest reply on Nov 28, 2007 2:39 PM by asaf sh

    Cache problem with Seam EntityQuery

    asaf sh Expert


      I have a list of entities(tasks) I manage via a seam component which extended from Seam EntityQuery,

      These tasks are sometimes gets updated via an EJB (Not seam) method which is triggered via EJB's time resource,

      Refreshing the task list -sometimes- showing old state of data although some of the tasks were already modified by the EJB methods,

      What is the default EntityQuery context? is it somehow related to Hibernate 2nd level cache? of course the EJB method uses Hibernate (via EM interface) to update the entities,

      Logoff/logon shows the new data, so I assume this is somehow related to Seam,

      Many thanks,


        • 1. Re: Cache problem with Seam EntityQuery
          Norman Richards Master

          If it is a pojo and you haven't changed it's scope, your query object is in the event context. Are you using a conversation? A Seam-managed persistence context is scoped to the conversation, so you won't see changes made in the EJB, which is probably using a different persistence context, while still in the conversation.

          • 2. Re: Cache problem with Seam EntityQuery
            asaf sh Expert

            well, if EntityQuery is a pojo then yes, I didn't change the scope,

            If I'm in a conversation, then the persistence context is in conversation scope although my class inherited from EntityQuery is in event scope? this is confusing :-)

            Well, back to the question, sometimes it's hard to truck if I'm in a conversation or not,
            Client sometimes not using the buttons which handles conversation ending correctly, so it might be, well, how can I make sure anytime a page is getting refreshed I get the most updated data from the DB?

            I tried to override the 'getResultList' method of EntityQuery and set some hints to hibernate to get the most updated data, but it seems not to be working,

            Anyway, probably this problem can be solved by Seam levels as I said and since logoff/logon shows the most updated data then I guess I'm in a conversation,

            So what is the correct way to solve this issue?

            Many thanks,