[jboss-user] [JBoss Seam] - Re: FlushModeType.MANUAL in conversation
kai222
do-not-reply at jboss.com
Mon Dec 17 16:10:48 EST 2007
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
More information about the jboss-user
mailing list