-
1. Re: Mixing @PersistenceContext with Seam Managed Persistence
gavin.king Nov 7, 2006 11:15 AM (in response to emsa)You can mix them, but you might have to explicitly flush() one if you want to see the results in the other.
-
2. Re: Mixing @PersistenceContext with Seam Managed Persistence
emsa Nov 7, 2006 4:04 PM (in response to emsa)Ok, but I'd like to understand why. I have no second-level cache and when I writing through the @PersistenceContext the data ends up in the database, no explicit flush().
So why is the data not fetched using the Seam Managed Persistence?
Where is the data cashed?
And why does flush() help?
Would putting the different Beans in diffrent deployments change anything? -
3. Re: Mixing @PersistenceContext with Seam Managed Persistence
gavin.king Nov 7, 2006 9:27 PM (in response to emsa)It is cached in the EM until the transaction commits.
-
4. Re: Mixing @PersistenceContext with Seam Managed Persistence
emsa Nov 8, 2006 5:06 AM (in response to emsa)Ok, but ias fas as I can see the data writing is commited. I can log on the database and see the correct data.
If I start a new application the correct data is read from the database. However the "Seam Managed Persistence" (SMP) does not re-read already read rows without an explicit refresh().
To me it seems like the EM used by the SMP is holding on to stale data.
Is there a way to turn on some logging to see the diffrent transactions and the their states and also to see what actuall data hibernate is reading/writing? -
5. Re: Mixing @PersistenceContext with Seam Managed Persistence
gavin.king Nov 8, 2006 9:39 AM (in response to emsa)An EM holds stale data until you close() o clear() it. This is just basic JPA. I recommend you spend some time with Hibernate in action or jpwh, to properly understand the semantics of a persistence context.
This question is not seam-related. -
6. Re: Mixing @PersistenceContext with Seam Managed Persistence
emsa Nov 8, 2006 11:08 AM (in response to emsa)Yes I'm aware of that - I just took for granted that the EM/Session was closed or cleared after the end of the web-request/transaction. I was apparently wrong.