Exemplo n.º 1
0
 @Test
 public void testJoinFetch() {
   String hqlString =
       "select distinct project from Tproject project left join fetch project.departmentSet department"
           + " where department.name like '%一分%' ";
   List<Tproject> list = projectDao.find(hqlString);
   for (Tproject project : list) {
     Long id = (Long) project.getId();
     projectDao.getCurrentSession().evict(project);
     Tproject p = projectDao.get(Tproject.class, id);
     /*System.out.println(project.getDepartmentSet().size());*/
     int size = p.getDepartmentSet().size();
     // size=project.getDepartmentSet().size();
     if (size > 1) System.out.println(size);
   }
 }
Exemplo n.º 2
0
 @Test
 public void testGet() {
   Tproject project = projectDao.get(Tproject.class, 8L);
   System.out.println(project.getDepartmentSet().size());
 }