Hi ,
I am new to Hibernate. i have a problem while iterating an ArrayList . I get this ArrayList from query using list.
My Code is here,
Code:
List<Long> userList = Arrays.asList(3L, 4L);
Query entityListQuery = session.createSQLQuery("select id from UserEntity where id in (:ids)");
entityListQuery.setParameterList("ids", userList);
ArrayList<UserEntity> UserEntity = null;
UserEntity = (ArrayList<UserEntity>) entityListQuery.list();
I have fetch a list (UserEntity) of values from this query.
While iterating the list ,
Code:
for(UserEntity entity :UserEntity){
UserDAO.getUser(entity.getId(), false);
}
i am getting an error like this
java.math.BigInteger cannot be cast to UserEntity.
how can i solve this. please help me