The following is happening to me when I'm using both @PersistenceContext and Seam
Managed Persistence, maybe this is a no-no?
1. I have a Stateless Session Bean (not managed by seam) that is called by Quartz
"once is while" to update some statistics in the database. This Bean is using
'@PersistenceContext' to inject an EntityManager and it is successfull in updating
the database.
2. I have a Bean that is managed by Seam that uses '@In(create = true) EntityManager
em' to inject an EntityManager. This EntityManager fails to read the updated data from
the database, if there's previoulsy read data this data is returned by the
EntityManager no mather if the data in the database is updated.
Both Beans above lives in the same .ejb3 and .ear.
I have tried to turn of the Second Level Cache but that did not help.
I have found two ways to get the correct data:
1. use em.refresh( .. ) on the stale data return by the em in (2) above.
2. use @PersistenceContext in (2) above instead of '@In ...'
Is it really impossible to mix the two diffrent ways to get hold on the EntityManager?
Where is the data cached and why is the updated data not fetched by the Seam Managed
EntityManager?
/Magnus
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983724#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...