I have a list of objects that having becode as string(setter,getter),i want to set the ststus as "active" for all the becodes.below is my query.but its giving exceptions as "java.lang.ClassCastException: com.rogers.tpia.model.updatetpia cannot be cast to java.lang.String".pls help me u will get appriciated.
public void activateUser(List<updatetpia> act){
        Session session = sessionFactory.getCurrentSession();
        Query query=session.createQuery("update updatetpia up set status=:status where up.becode in (:acts)");
        query.setString("status","Active");
        query.setParameterList("acts",act );
        int modifications=query.executeUpdate();

Hi hari,

please be clear on your question otherwise it will be very difficult to answer your question for the people over here.

coming to your question, you wanted to set the status code for all the becode objects right
in that why you need of this line of code

query.setParameterList("acts",act );

correct me if i am wrong

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.