hibernatestylerepositorydao.java

来自「OBPM是一个开源」· Java 代码 · 共 45 行

JAVA
45
字号
package cn.myapps.core.style.repository.dao;

import java.util.Collection;
import java.util.HashSet;

import cn.myapps.base.action.ParamsTable;
import cn.myapps.base.dao.HibernateBaseDAO;
import cn.myapps.core.style.repository.ejb.StyleRepositoryVO;

public class HibernateStyleRepositoryDAO extends HibernateBaseDAO implements
		StyleRepositoryDAO {
	public HibernateStyleRepositoryDAO(String voClassName) {
		super(voClassName);
	}

	public StyleRepositoryVO getRepositoryByName(String name, String application)
			throws Exception {
		String hql = "from StyleRepositoryVO sp where sp.name=" + "'" + name
				+ "'";
		
		if (application != null && application.length()>0) {
			hql+=(" and vo.applicationid = '"+application+"' ");
		}
		
		return (StyleRepositoryVO) this.getData(hql);
	}

	public Collection getStyleRepositoryByModule(String moduleid,
			String application) throws Exception {

		String hql = "from StyleRepositoryVO sp where sp.module.id='"
				+ moduleid + "'";
		   ParamsTable params=new ParamsTable();
		   params.setParameter("application",application);
		   return getDatas(hql, params);
	}

	public Collection getStyleRepositoryByApplication(String applicationid) throws Exception {

		String hql = "from StyleRepositoryVO sp where (sp.applicationid='"
				+ applicationid + "' ) "
				+ " and sp.module is null";
		   return getDatas(hql);
	}
}

⌨️ 快捷键说明

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