0

I have a problem with the flush Mode on a conversation:

If I set the flush Mode to manual in the @Begin(..) annotation, Hibernate still populates any changes on the attached entity directly to the database.

CustomerBranch is Entity

@Begin(join=true) public String addCustBranch() throws Exception {

 CustomerBranch customerBranch=new CustomerBranch();
 BeanUtils.copyProperties(customerBranch,doCustomerBranch)

branchesMap.get(selectedBranch.toLowerCase()).getCustomerBranch().add(customerBranch)
 custBranchesList.add(customerBranch); 
 }
 @Begin(flushMode=FlushModeType.MANUAL,join = true)

 public void populateSelectedList() throws Exception {

    // PersistenceProvider.instance().setFlushModeManual(getEntityManager());

     ((Session)getEntityManager().getDelegate()).setFlushMode(FlushMode.MANUAL);

      custBranchesList.clear();

             custBranchesList.addAll(branchesMap.get(selectedBranch.toLowerCase()).getCustomerBranch());

}

In the above method, I add list to custBranchesList here I can't use any persist still directly change reflect the database

componet.xml

conversation-timeout="120000" parent-conversation- id-parameter="pid"/>

<web:hot-deploy-filter url-pattern="/*.mobee"/>



<persistence:entity-manager-factory installed="@seamBootstrapsPu@"

  name="entityManagerFactory" persistence-unit-name="mobeeadmin"/>

<persistence:managed-persistence-context auto-create="true"

  entity-manager-factory="@seamEmfRef@" name="entityManager" persistence-unit-jndi- name="@puJndiName@"/>
Artemis
  • 2,553
  • 7
  • 21
  • 36
nag
  • 647
  • 6
  • 25
  • 43

1 Answers1

0

Maybe you are already inside a conversation when your @Begin method executes? join=true just keeps the prior conversation untouched and does not change its flushMode even if you specified another value. To check try nested=true.

EmirCalabuch
  • 4,756
  • 1
  • 25
  • 20