[jboss-user] [JBoss Seam] - Why do I need to use entityManager.flush() ?

w17chm4n do-not-reply at jboss.com
Fri Dec 7 05:49:25 EST 2007


Why do I need to use flush() when using SMPC ?

Before I had this

  | @Stateful
  | @Scope(ScopeType.APPLICATION)
  | @Name("questionTypeManager")
  | public class QuestionTypeManagerBean implements QuestionTypeManager {
  | 
  |     @Logger
  |     Log log;
  | 
  |     @PersistenceContext
  |     EntityManager entityManager;
  | 
  |     public void addQuestionType(String questionType) {
  |         entityManager.persist(new QuestionType(questionType));
  |         log.info("Successfuly persisted question type");
  |     }
  | 
  |     @Remove @Destroy
  |     public void destroy() {}
  | 
  | }
  | 

But when I`ve switched to SMPC I had to add entityManager.flush() couse entityManager didn`t persist QuestionType to the database. It didn`t show any errors either.

Why is that ?

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

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



More information about the jboss-user mailing list