예제 #1
0
 /**
  * @param session
  * @param condition
  * @param orderBy
  * @return
  * @throws PersistentException
  */
 public CommentTask[] listCommentTaskByQuery(
     PersistentSession session, String condition, String orderBy) throws PersistentException {
   StringBuffer sb = new StringBuffer("From de.fhb.jproject.data.CommentTask as CommentTask");
   if (condition != null) sb.append(" Where ").append(condition);
   if (orderBy != null) sb.append(" Order By ").append(orderBy);
   try {
     Query query = session.createQuery(sb.toString());
     List list = query.list();
     return (CommentTask[]) list.toArray(new CommentTask[list.size()]);
   } catch (Exception e) {
     _logger.error(
         "listCommentTaskByQuery(PersistentSession session, String condition, String orderBy)", e);
     throw new PersistentException(e);
   }
 }
예제 #2
0
 /**
  * @param session
  * @param condition
  * @param orderBy
  * @return
  * @throws PersistentException
  */
 public static java.util.Iterator iterateCommentTaskByQuery(
     PersistentSession session, String condition, String orderBy) throws PersistentException {
   StringBuffer sb = new StringBuffer("From de.fhb.jproject.data.CommentTask as CommentTask");
   if (condition != null) sb.append(" Where ").append(condition);
   if (orderBy != null) sb.append(" Order By ").append(orderBy);
   try {
     Query query = session.createQuery(sb.toString());
     return query.iterate();
   } catch (Exception e) {
     _logger.error(
         "iterateCommentTaskByQuery(PersistentSession session, String condition, String orderBy)",
         e);
     throw new PersistentException(e);
   }
 }