conversation flush-mode

页面配置文件中定义了对话的flush模式

<begin-conversation join="true" flush-mode="MANUAL"/>

 

代码里必须主动调用em.flush();,否则不会更新数据库

public void updateJgdwGN(Jgdwjbxxb jgdw,List<TreeNodeVO> gns){
        em.createQuery("delete JsfjgnlbENT u where u.jgdw=:jgdw").setParameter("jgdw", jgdw).executeUpdate();
        for(TreeNodeVO item:gns){
            XtgnbENT xtgn=(XtgnbENT)item.getData();
           
            if(xtgn.isSffjgn()){
                JsfjgnlbENT up=new JsfjgnlbENT();
                up.setJgdw(jgdw);
                up.setGn(xtgn);
                em.persist(up);
            }
        }
        em.flush();
    }

pages.java

private static void parseConversationControl(Element element, ConversationControl control){

 

Element beginConversation = element.element("begin-conversation");
      beginConversation = beginConversation == null ? element.element("begin-task") : beginConversation;
      beginConversation = beginConversation == null ? element.element("start-task") : beginConversation;
      if ( beginConversation!=null )
      {
         control.setBeginConversation (true);
         control.setJoin( Boolean.parseBoolean( beginConversation.attributeValue("join") ) );
         control.setNested( Boolean.parseBoolean( beginConversation.attributeValue("nested") ) );
         control.setPageflow( beginConversation.attributeValue("pageflow") );
         control.setConversationName( beginConversation.attributeValue("conversation") );
         String flushMode = beginConversation.attributeValue("flush-mode");
         if (flushMode!=null)
         {
            control.setFlushMode ( FlushModeType.valueOf( flushMode.toUpperCase() ) );
         }
         String expression = beginConversation.attributeValue("if");
         if (expression!=null)
         {
            control.setBeginConversationCondition( Expressions.instance().createValueExpression(expression, Boolean.class) );
         }

ConversationControl

/*

Demarcation of the conversation in pages.xml

*/

package org.jboss.seam.navigation;

public class ConversationControl

 

你可能感兴趣的:(xml,jboss,UP,seam)