I use the following to pass in a collection as a parameter list but do it in a 
hibernate callback.
hth,
Ron

    public List getIpdrsToRate(final Collection listOfStatusToRate, final 
String subscriberToRate) throws DataAccessException {
        
        return getHibernateTemplate().executeFind(new HibernateCallback() {
            public Object doInHibernate(Session session) throws 
HibernateException {
                Query query = session.createQuery(
                        "from Ipdr ipdr where ipdr.ratingStatus IN 
(:ratingStatusList) " +
                " AND ipdr.subscriberID = :subscriberId ");
                query.setParameterList("ratingStatusList", listOfStatusToRate);
                query.setString("subscriberId", subscriberToRate);
                query.setMaxResults(MAX_BATCH_SIZE.intValue());
                return query.list();
            }
        });
    }

----- Original Message ----
From: Bandula <[EMAIL PROTECTED]>
To: users@appfuse.dev.java.net; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, January 19, 2008 9:47:21 AM
Subject: [appfuse-user] Passing set of User objects as Argument in HQL





 
 

<!--
 _filtered {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        
{margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:"Calibri", 
"sans-serif";}
a:link, span.MsoHyperlink
        {color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;text-decoration:underline;}
pre
        {margin:0in;margin-bottom:.0001pt;font-size:10.0pt;font-family:"Courier 
New";}
span.EmailStyle17
        {font-family:"Calibri", "sans-serif";color:windowtext;}
span.HTMLPreformattedChar
        {font-family:"Courier New";}
.MsoChpDefault
        {}
 _filtered {margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {}
-->






  
 

Dear All;  
 

  
 

I get exception “java.lang.reflect.InvocationTargetException” when I call 
following method in CommentDaoHibernate.java class. I want to pass set of User 
objects to field assignedParty in following HQL. Can someone please suggest a 
way to pass User object list.  

        
 

  
 

  
 

  
 

public
List<Comment> findCommentByChangeRequestForRole(ChangeRequest
changeRequest, List<User> userList){
 

          
 

       
Object[] params = new Object[2];
 

       
params[0] = userList;
 

       
params[1] = changeRequest;
 

       

 

       
return getHibernateTemplate().find(("from
Comment c 
 

where
c.assignedParty in (?) AND c.changeRequest = ? ORDER BY c.sid", params);
 

      
 

}
 

  
 

  
 

Thanks 
 

Bandula
 







Reply via email to