You can mix them, but you might have to explicitly flush() one if you want to see the results in the other.
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?
It is cached in the EM until the transaction commits.
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?
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.
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.