会話のフラッシュ モードに問題があります。
@Begin(..) アノテーションでフラッシュ モードを手動に設定すると、Hibernate はアタッチされたエンティティの変更をデータベースに直接入力します。
CustomerBranch はエンティティです
@Begin(join=true) public String addCustBranch() は例外をスローします {
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());
}
上記の方法では、ここで custBranchesList にリストを追加します。データベースを直接変更して永続化することはできません。
コンポーネント.xml
会話タイムアウト="120000" 親会話-id-パラメーター="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@"/>