hibernate like in 查询_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > hibernate like in 查询

hibernate like in 查询

 2012/9/8 11:52:11  zwhc  程序员俱乐部  我要评论(0)
  • 摘要:publicListgetMaintainList(StringpersId,Stringstatus){String[]aStat=status.split(",");Stringparam="?";for(inti=1;i<aStat.length;i++){param+=",?";}Stringhql="selectm.mtnId,m.devName,m.positionNamefromMaintainm,Planningp"+"wherem.planId=p.planIdandp
  • 标签:hibernate
	public List getMaintainList(String persId, String status) {
		String[] aStat = status.split(",");
		String param = "?";
		for(int i=1; i<aStat.length; i++)
		{
			param += ",?";
		}
		String hql = "select m.mtnId, m.devName, m.positionName from Maintain m, Planning p " +
		"where m.planId = p.planId and p.beginDate<sysdate and p.endDate>sysdate" +
		" and m.persIds like ? and m.status in ( " + param + ") ";
		String pPersId = "%;" + persId + ";%";
		Object[] oParam = new Object[aStat.length+1];
		oParam[0] = pPersId;
		for(int i=1; i<oParam.length; i++)
		{
			oParam[i] = new Long(aStat[i-1]);
		}
		List list = findListByHql(hql, oParam);
		
		return list;
	}

发表评论
用户名: 匿名