comparison src/main/java/org/mpi/openmind/repository/services/PersistenceService.java @ 22:165b1efb85cd

remove group-by clause for attribute search filter because it gave hibernate errors :-(
author casties
date Mon, 27 Jun 2016 19:09:37 -0400
parents 615d27dce9b3
children 5e24413d355b
comparison
equal deleted inserted replaced
21:7af7a18e9573 22:165b1efb85cd
1341 try { 1341 try {
1342 Session session = HibernateUtil.getSessionFactory() 1342 Session session = HibernateUtil.getSessionFactory()
1343 .getCurrentSession(); 1343 .getCurrentSession();
1344 session.getTransaction().begin(); 1344 session.getTransaction().begin();
1345 1345
1346 String hql = "from Entity as ent, Attribute as att " + "where " 1346 String hql = "FROM Entity AS ent, Attribute AS att "
1347 + "WHERE "
1347 + "att.systemStatus = :systemStatus AND " 1348 + "att.systemStatus = :systemStatus AND "
1348 + "ent.systemStatus = :systemStatus AND " 1349 + "ent.systemStatus = :systemStatus AND "
1349 + "ent.id = att.sourceId AND ("; 1350 + "ent.id = att.sourceId AND (";
1350 1351
1351 int count = 0; 1352 int count = 0;
1376 count++; 1377 count++;
1377 if (filters.size() > count) 1378 if (filters.size() > count)
1378 hql += " OR "; 1379 hql += " OR ";
1379 } 1380 }
1380 1381
1381 hql += " ) group by att.sourceId order by ent.ownValue"; 1382 /* ROC: led to hibernate errors
1383 * hql += " ) group by att.sourceId order by ent.ownValue";
1384 */
1385 hql += " ) order by ent.ownValue";
1382 1386
1383 Query query = session.createQuery(hql); 1387 Query query = session.createQuery(hql);
1384 if (maxResult > 0) 1388 if (maxResult > 0)
1385 query.setMaxResults(maxResult); 1389 query.setMaxResults(maxResult);
1386 query.setString("systemStatus", Node.SYS_STATUS_CURRENT_VERSION); 1390 query.setString("systemStatus", Node.SYS_STATUS_CURRENT_VERSION);