Dao层定义执行SQL语句的方法

@Repository
public class QsPatientCodeDaoImpl extends HibernateBaseImpl<QsPatientCodePO> implements QsPatientCodeDao {

    @Resource(name = "sessionFactory")
    private SessionFactory sessionFactory;

    public List<Object[]> queryBySql(String sql){
        List<Object[]> list = getSession().createSQLQuery(sql).list();
        return list;
    }

    public Session getSession() {
        return sessionFactory.getCurrentSession();
    }
}


猜你喜欢

转载自blog.csdn.net/qq_30629571/article/details/79093752