⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hibernateviewdao.java

📁 OBPM是一个开源
💻 JAVA
字号:
package cn.myapps.core.dynaform.view.dao;

import java.util.Collection;
import java.util.List;

import org.hibernate.Session;

import cn.myapps.base.action.ParamsTable;
import cn.myapps.base.dao.DataPackage;
import cn.myapps.base.dao.HibernateBaseDAO;
import cn.myapps.base.dao.PersistenceUtils;
import cn.myapps.core.dynaform.view.ejb.View;

public class HibernateViewDAO extends HibernateBaseDAO implements ViewDAO {
	public HibernateViewDAO(String voClassName) {
		super(voClassName);
	}

	public View findViewByName(String name, String application) throws Exception {
		String hql = "from " + _voClazzName + " vo where vo.name= ?";

		ParamsTable params = new ParamsTable();
		params.setParameter("application", application);

		Collection coll = getDatas(hql, params);

		if (coll != null && !coll.isEmpty())
			return (View) coll.iterator().next();
		else
			return null;
		// Session session = PersistenceUtils.currentSession();
		// List list = session.createQuery(hql).setString(0, name).list();
		//
		// if (list != null && !list.isEmpty()) {
		// return (View) list.get(0);
		// } else {
		// return null;
		// }
	}

	public DataPackage getViewsByModuleId(String moduleid, String application)
			throws Exception {
		String hql = "FROM " + _voClazzName + " vo WHERE vo.module.id='"
				+ moduleid + "'";
		ParamsTable params = new ParamsTable();
		params.setParameter("application", application);

		return this.getDatapackage(hql, params);
	}

	public Collection getViewByModule(String moduleid, String application)
			throws Exception {
		String hql = "FROM " + _voClazzName + " vo WHERE vo.module.id='"
				+ moduleid + "'";
		ParamsTable params = new ParamsTable();
		params.setParameter("application", application);
		return getDatas(hql, params);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -