[jboss-user] [EJB 3.0 Users] - EntityBean loading: immediate update after read an entity

tschwarz do-not-reply at jboss.com
Mon Aug 24 12:41:12 EDT 2009


Hi all,

I have a strange behavior of my EJB 3. 
As soon as I read an entity using the EntityManager I can see an select statement send to the database, but followed by an immediate update statement that is send to the database.

I have a couple of finder-methods in my session bean. That methods are using the EntityManger to find my entity beans. Even a simple invocation of a find by primary key method is leads to an immediate update. 

After every update the entity's version is changed, making it impossible to save my real changes, that are coming from the presentation layer.

Any idea what might be the reason for those strange updates? How can I change this?

Code sniplet:

  | @Stateless
  | public class OrderServiceBean {
  | 
  |   @PersistenceContext
  |     private EntityManager em;
  | 
  |   public Order findOrderById(Long id) {
  |     return em.find(Vorgang.class, id);
  |   }
  | 
  | }
  | 

Thanks for your help in advance
Thorsten

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4251250#4251250

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4251250



More information about the jboss-user mailing list