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@"/>