Package railo.runtime.functions.orm

Source Code of railo.runtime.functions.orm.ORMReload

package railo.runtime.functions.orm;

import railo.runtime.PageContext;
import railo.runtime.exp.PageException;
import railo.runtime.orm.ORMConfiguration;
import railo.runtime.orm.ORMSession;
import railo.runtime.orm.ORMUtil;

public class ORMReload {
  public static String call(PageContext pc) throws PageException {
   
    // flush and close session
    ORMSession session = ORMUtil.getSession(pc,false);
    if(session!=null) {// MUST do the same with all sesson using the same engine
      ORMConfiguration config = session.getEngine().getConfiguration(pc);
      if(config.autoManageSession()) {
        session.flush(pc);
        session.close(pc);
      }
    }
    pc.getApplicationContext().reinitORM(pc);
    ORMUtil.resetEngine(pc,true);
    return null;
  }
}
TOP

Related Classes of railo.runtime.functions.orm.ORMReload

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.