/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  jakarta.persistence.FlushModeType
 *  org.hibernate.FlushMode
 *  org.hibernate.HibernateException
 *  org.hibernate.Session
 *  org.springframework.orm.hibernate5.HibernateCallback
 */
package com.l7tech.server.util;

import jakarta.persistence.FlushModeType;
import java.sql.SQLException;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate5.HibernateCallback;

public abstract class ReadOnlyHibernateCallback<RT>
implements HibernateCallback<RT> {
    public RT doInHibernate(Session session) throws HibernateException {
        FlushModeType flushModeType = session.getFlushMode();
        try {
            session.setFlushMode(FlushMode.MANUAL);
            RT RT = this.doInHibernateReadOnly(session);
            return RT;
        }
        catch (SQLException sQLException) {
            throw new HibernateException((Throwable)sQLException);
        }
        finally {
            session.setFlushMode(flushModeType);
        }
    }

    protected abstract RT doInHibernateReadOnly(Session var1) throws HibernateException, SQLException;
}

