-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: java.lang.ClasscastException
PostPosted: Tue Mar 08, 2011 12:39 am 
Newbie

Joined: Mon Mar 07, 2011 7:52 am
Posts: 4
Hello all,

Can anyone help me understand java.lang.classcastException.
I am trying to delete no of records using 'in' clause in hibernate.and when i pass an array to query it shows classcastexception.

Long idn[]={1,3};
query = session.createQuery("delete from Rolecomponentdisplaysettings as rcds where rcds.id.displaysettingid IN(:value) And rcds.id.roleid=:value1");

query.setParameter("value1", roleId); //roleId is of String type

query.setParameter("value",idn ); //idn is og long array

query.executeUpdate();


Top
 Profile  
 
 Post subject: Re: java.lang.ClasscastException
PostPosted: Tue Mar 08, 2011 4:16 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Use one of the Query.setParameterList() variants instead of Query.setParameter().


Top
 Profile  
 
 Post subject: Re: java.lang.ClasscastException
PostPosted: Fri Mar 11, 2011 1:38 am 
Newbie

Joined: Mon Mar 07, 2011 7:52 am
Posts: 4
Use one of the Query.setParameterList() variants instead of [i]Query.setParameter()



thanx a ton..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.