Posts

Showing posts from April 8, 2019

ClassCastException for com.querydsl.core.Tuple

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box; 1 I am getting exception as java.lang.ClassCastException: com.chat.dao.model.PGUserRoles cannot be cast to com.querydsl.core.Tuple My code seems to be correct. JPAQuery<Tuple> query = new JPAQuery<Tuple>(entityManager); QPGUserRoles pgUserRoles = QPGUserRoles.pGUserRoles; List<Tuple> dataList = query .from(pgUserRoles) .where(isRoleName(userRolesDTO.getRoleName()), isRoleType(userRolesDTO.getRoleType()), isStatus(userRolesDTO.getStatus()), isStatusNotEq() ) .offset(offset) .limit(limit) .orderBy(orderByRoleIdDesc()) .fetch(); UserRolesDTO userData = null; for (Tuple tuple : dataList) userData = new UserRolesDTO(); userData.setRoleId(tuple.get(pgUserRoles.roleId)); userData.setRoleName(tuple.get(pgUserRoles.roleName)); userData.setRoleType(tuple.get(pgUserRoles.roleType)); userD