hibernate如何查询多条件 ,且条件数不定的方法
要求:页面上详细查询条件有10条,所有都可以不添,为全查。   按照客户添的条件在后台查找符合全部要求的数据。   因为我刚学hibernate   所以问一下有什么方法可以实现这种查询吗???   
 表的映射和关联已配好。   我现在在service层用无数个判断条件来判断怎么查询,但这种方法太影响效率。请问hibernate有方便的方法吗?   例如ibatis里的isNotEmpty.
------解决方案--------------------可以用反射获取pojo的所有字段和类型以及值,然后根据类型和值动态拼凑字符串,不过这个效率会有一点影响!
------解决方案--------------------mark
------解决方案--------------------使用QBC动态查询:   
 import org.hibernate.Criteria; 
 import org.hibernate.Query;   
 			Session session=HibernateSessionFactory.currentSession(); 
 			//QBC(Query by Criteria)动态查询 �𗘗 
 			Criteria crit=session.createCriteria(Team.class);  			 
 			//如果相应属性不为空,则按相应属性查询 
 			if(stuName!=null){ 
 				crit.add(Restrictions.like( "stuName ",stuName,MatchMode.ANYWHERE)); 
 			} 
 			if(oldTeamName!=null){ 
 				crit.add(Restrictions.like( "oldTeamName ",oldTeamName,MatchMode.ANYWHERE)); 
 			} 
 			if(applyDate!=null){ 
 				crit.add(Restrictions.like( "applyDate ",applyDate,MatchMode.ANYWHERE)); 
 			} 
 			if(examineState!=null){ 
 				crit.add(Restrictions.like( "examineState ",examineState,MatchMode.ANYWHERE)); 
 			}   
 ==================================== 
 这是一个例子,参考一下