public List<UserDetailsDTO> getPID(List<UserDetailsDTO> list) { Session session = getSession(); session.getTransaction().begin(); for (UserDetailsDTO userDetailsDTO : list) { Criteria criteriaProxy = session.createCriteria(ProxyDetails.class, "proxyDetails"); criteriaProxy.add( Restrictions.eq("proxyDetails.browserDetails.BID", userDetailsDTO.getBid())); criteriaProxy.setProjection( Projections.projectionList().add(Projections.property("PID").as("pid"))); List<Long> pidList = criteriaProxy.list(); userDetailsDTO.setPid(pidList); } session.getTransaction().commit(); session.close(); return list; }
public void displayData(List<UserDetailsDTO> list) { for (UserDetailsDTO userDetailsDTO : list) { System.out.println("SID" + userDetailsDTO.getSid()); System.out.println("BID" + userDetailsDTO.getBid()); System.out.println("DID" + userDetailsDTO.getDid()); System.out.println("EID" + userDetailsDTO.getEid()); for (Long id : userDetailsDTO.getPid()) { System.out.println("PID" + id); } } }