1 Reply Latest reply on Dec 7, 2006 4:46 AM by Pete Muir

    Flushing changes to objects quickly

    None None Master

      Here's the problem: I have a form that updates a bunch of objects that are in a Collection. The model objects get updated correctly, but they aren't instantly saved to the database. I can put in entityManager.flush() which should save them, but here's the question / problem: the objects were outjected by another SFSB with an extended persistence context. If I do the entityManager.flush() in some other SFSB (not the one that originally outjected the objects), will I be using a different EntityManager? I put in a entityManager.flush() statement and it doesn't seem to do anything.

      Any ideas on this? It's confusing to me.

        • 1. Re: Flushing changes to objects quickly
          Pete Muir Master

          I think if you are using @PersistenceContext(type=EXTENDED) then the EntityManager is scoped to that SFSB. Therefore, if you load an Entity in SFSB_A (EntityManager_A) then if you call flush in SFSB_B then the entity won't be flushed as it isn't managed by EntityManager_B.

          The solution is to use Seam Managed Persistence Context.