All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dream.solon.holder.SolonSessionHolder Maven / Gradle / Ivy

The newest version!
package com.dream.solon.holder;

import com.dream.system.core.session.Session;
import com.dream.system.core.session.SessionFactory;
import com.dream.template.session.SessionHolder;
import org.noear.solon.data.tran.TranUtils;

public class SolonSessionHolder implements SessionHolder {
    private SessionFactory sessionFactory;

    public SolonSessionHolder(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    @Override
    public Session getSession() {
        return sessionFactory.openSession(false);
    }

    @Override
    public void closeSession(Session session) {
        session.close();
    }

    @Override
    public boolean isSessionTransactional(Session session) {
        return TranUtils.inTrans();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy