public List lookupResourceComponentByParentResourceComponent(
      ResourcesComponents rc, Session session) {
    long t1;
    long t2;
    ResourcesComponents rcmps = null;
    ArrayList al = new ArrayList();
    Iterator it = null;
    t1 = System.currentTimeMillis();
    List res =
        session
            .getNamedQuery("mySqlQuery")
            .setLong("resourceComponentId", rc.getIdentifier())
            .list();
    t2 = System.currentTimeMillis();
    it = res.iterator();
    Object t[];
    while (it.hasNext()) {
      rcmps = new ResourcesComponents();
      t = (Object[]) it.next();
      rcmps.setTitle((String) t[0]);
      rcmps.setDateExpression((String) t[1]);
      rcmps.setIdentifier((Long) t[2]);
      rcmps.setHasChild((Boolean) t[3]);
      rcmps.setSequenceNumber((Integer) t[4]);
      al.add(rcmps);
    }

    return al;
  }
 public List lookupResourceComponentByParentResource(Resources r, Session session) {
   // Session session = SessionFactory.getInstance().openSession();
   long t1, t2;
   t1 = System.currentTimeMillis();
   Criteria criteria =
       session
           .createCriteria(ResourcesComponents.class)
           .addOrder(Order.asc("resourcesOrder"))
           //				.setProjection(Projections.projectionList()
           //						.add(Projections.property(ResourcesComponents.PROPERTYNAME_TITLE))
           //						.add(Projections.property(ResourcesComponents.PROPERTYNAME_SEQUENCE_NUMBER))
           //
           //	.add(Projections.property(ResourcesComponents.PROPERTYNAME_RESOURCES_COMPONENT_ID))
           //						.add(Projections.property(ResourcesComponents.PROPERTYNAME_DATE_EXPRESSION)))
           //				.setResultTransformer(new AliasToBeanResultTransformer(ResourcesComponents.class))
           .add(Expression.eq("resource", r));
   //		t2 = System.currentTimeMillis();
   //        System.out.println("query1 time = "+(t2-t1)+" milliseconds");
   List al = new ArrayList();
   al = criteria.list();
   // session.close();
   return al;
 }