Search in sources :

Example 1 with ORMEngine

use of lucee.runtime.orm.ORMEngine in project Lucee by lucee.

the class PageContextImpl method releaseORM.

private void releaseORM() throws PageException {
    try {
        // flush orm session
        ORMEngine engine = ormSession.getEngine();
        ORMConfiguration config = engine.getConfiguration(this);
        if (config == null || (config.flushAtRequestEnd() && config.autoManageSession())) {
            ormSession.flushAll(this);
        }
        ormSession.closeAll(this);
        manager.releaseORM();
    } finally {
        ormSession = null;
    }
}
Also used : ORMEngine(lucee.runtime.orm.ORMEngine) ORMConfiguration(lucee.runtime.orm.ORMConfiguration)

Example 2 with ORMEngine

use of lucee.runtime.orm.ORMEngine in project Lucee by lucee.

the class ConfigImpl method getORMEngine.

@Override
public ORMEngine getORMEngine(PageContext pc) throws PageException {
    String name = pc.getApplicationContext().getName();
    ORMEngine engine = ormengines.get(name);
    if (engine == null) {
        // try {
        Throwable t = null;
        try {
            engine = (ORMEngine) ClassUtil.loadInstance(cdORMEngine.getClazz());
            engine.init(pc);
        } catch (ClassException ce) {
            t = ce;
        } catch (BundleException be) {
            t = be;
        } catch (NoClassDefFoundError ncfe) {
            t = ncfe;
        }
        if (t != null) {
            ApplicationException ae = new ApplicationException("cannot initialize ORM Engine [" + cdORMEngine + "], make sure you have added all the required jar files");
            ae.setStackTrace(t.getStackTrace());
            ae.setDetail(t.getMessage());
        }
        ormengines.put(name, engine);
    /*}
			catch (PageException pe) {
				throw pe;
			}*/
    }
    return engine;
}
Also used : ApplicationException(lucee.runtime.exp.ApplicationException) ORMEngine(lucee.runtime.orm.ORMEngine) ClassException(lucee.commons.lang.ClassException) BundleException(org.osgi.framework.BundleException)

Example 3 with ORMEngine

use of lucee.runtime.orm.ORMEngine in project Lucee by lucee.

the class ConfigImpl method resetORMEngine.

public ORMEngine resetORMEngine(PageContext pc, boolean force) throws PageException {
    // String name = pc.getApplicationContext().getName();
    // ormengines.remove(name);
    ORMEngine e = getORMEngine(pc);
    e.reload(pc, force);
    return e;
}
Also used : ORMEngine(lucee.runtime.orm.ORMEngine)

Aggregations

ORMEngine (lucee.runtime.orm.ORMEngine)3 ClassException (lucee.commons.lang.ClassException)1 ApplicationException (lucee.runtime.exp.ApplicationException)1 ORMConfiguration (lucee.runtime.orm.ORMConfiguration)1 BundleException (org.osgi.framework.BundleException)1