I solved it myself by manually switching the entityManager.setFlushMode just 
before the query invocation:
        

  | ...
  |     private boolean emailExists() {
  |             
entityManager.setFlushMode(javax.persistence.FlushModeType.COMMIT);
  |             List<String> existing = (List<String>)
  |                     entityManager.createQuery("from MyUser u where u.email 
= :email)")
  |                             .setParameter("email", selectedUser.getEmail())
  |                             .getResultList();
  |             if(existing.size() != 0) {
  |                     facesMessages.add("#{messages['NewEmailExists']}" + 
selectedUser.getEmail());
  |                     return true;
  |             }
  |             return false;
  |     }
  | ...
  | 

Switching to COMMIT for an EntityManager disables automatic synchronization 
before queries.

Please note that it is the javax.persistence.FlushModeType class, not from Seam.

This is not the most elegant way but it fixes my problem now. I would highly 
appreciate the opinion of an expert... 

Is the dysfunction of org.jboss.seam.annotations.FlushModeType.MANUAL a bug in 
Seam?

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113559
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to