Hibernate in inquiry

xiaoxiao2021-03-06  20

Stringbuffer buf = new stringbuffer (); if (! Forobject) {buf.append ("select count (*));} buf.append (" from agent agent where 1 = 1);

String gradeid = (string) confitions.get ("gradeid"); if (gradeid! = Null&&! Gradeid.equals (") && gradeid! =" ") {Buf.append (" and age.gradeid = ") .append (gradeid);

BUF.Append ("And Agent.Agentid IN (: Agentids)");

Query query = sess.createQuery (buf.toString ()); List ids = CommisionInfoDelegateExt.findAgentIdList (conditions); System.out.println ( "ids.length =" ids.size ()); query.setParameterList ( "agentIds ", IDS);

When the IDS length is 0 (empty record), query.list () error. No way, now in ids.add ("- 1"), plug in an absolutely absent record ID (absolutely impossible).

转载请注明原文地址:https://www.9cbs.com/read-42732.html

New Post(0)