Examples of createQuery()


Examples of org.hibernate.Session.createQuery()

      hql.append(" AND a.writeTime >= :beginTime AND a.writeTime < :endTime");
    }
    hql.append(" ORDER BY a.id DESC");
    try {
      Session ssn = getSession();
      Query q = ssn.createQuery(hql.toString());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("site", site.getId());
      if(user==null || site.getOwner().getId() != user.getId()){
        q.setInteger("cat_type", CatalogBean.TYPE_OWNER);
        if(user != null){
View Full Code Here

Examples of org.hibernate.Session.createQuery()

      hql.append(')');
      hql.append(" AND (r.ownerOnly = 0 OR r.user.id = :userid)");
    }
    hql.append(" ORDER BY r.id DESC");
    Session ssn = getSession();
    Query q = ssn.createQuery(hql.toString());
    q.setInteger("status", DiaryReplyBean.STATUS_NORMAL);
    q.setInteger("site", site.getId());
    q.setInteger("diary_status", DiaryOutlineBean.STATUS_NORMAL);
    if(!site.isOwner(user)){
      q.setInteger("cat_type", CatalogBean.TYPE_OWNER);
View Full Code Here

Examples of org.hibernate.Session.createQuery()

      if(user != null)
        hql.append(" OR (r.diary.catalog.type=? AND r.diary.catalog.id IN (SELECT p.key.catalog FROM CatalogPermBean AS p WHERE p.key.user=?))");
      hql.append(')');
    }
    Session ssn = getSession();
    Query q = ssn.createQuery(hql.toString());
    q.setInteger(0, DiaryReplyBean.STATUS_NORMAL);
    q.setInteger(1, site.getId());
    if(!site.isOwner(user)){
      q.setInteger(2, CatalogBean.TYPE_OWNER);
      if(user != null){
View Full Code Here

Examples of org.hibernate.Session.createQuery()

    }
    hql.append("?)");
    Session ssn = getSession();
    try{
      beginTransaction();
      Query q = ssn.createQuery(hql.toString());
      q.setInteger(0, ownerId);
      int i=0;
      for(;i<max_msg_count;i++){
        String s_id = (String)msgIds[i];
        int id = -1;
View Full Code Here

Examples of org.hibernate.Session.createQuery()

    }
    hql.append("?)");
    Session ssn = getSession();
    try{
      beginTransaction();
      Query q = ssn.createQuery(hql.toString());
      q.setInteger(0, ownerId);
      int i=0;
      for(;i<friendIds.length;i++){
        String s_id = (String)friendIds[i];
        int id = -1;
View Full Code Here

Examples of org.hibernate.Session.createQuery()

    }
    hql.append("?)");
    Session ssn = getSession();
    try{
      beginTransaction();
      Query q = ssn.createQuery(hql.toString());
      q.setInteger(0, ownerId);
      int i=0;
      for(;i<otherIds.length;i++){
        String s_id = (String)otherIds[i];
        int id = -1;
View Full Code Here

Examples of org.hibernate.Session.createQuery()

   */
  protected static void transfer_diary_replies() throws Exception{
    Session ssn = HibernateUtils.getSession();
    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM DiaryReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        DiaryReplyBean rpl = (DiaryReplyBean)rpls.get(i);
        CommentBean cb = new CommentBean();
        cb.setClient(rpl.getClient());
        AuthorInfo author = new AuthorInfo();
View Full Code Here

Examples of org.hibernate.Session.createQuery()

   */
  protected static void transfer_photo_replies() throws Exception{
    Session ssn = HibernateUtils.getSession();
    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM PhotoReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        PhotoReplyBean rpl = (PhotoReplyBean)rpls.get(i);
        CommentBean cb = new CommentBean();
        cb.setClient(rpl.getClient());
        AuthorInfo author = new AuthorInfo();
View Full Code Here

Examples of org.hibernate.Session.createQuery()

   */
  protected static void transfer_bbs_replies() throws Exception{
    Session ssn = HibernateUtils.getSession();
    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM TopicReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        TopicReplyBean rpl = (TopicReplyBean)rpls.get(i);
        CommentBean cb = new CommentBean();
        cb.setClient(rpl.getClient());
        AuthorInfo author = new AuthorInfo();
View Full Code Here

Examples of org.hibernate.Session.createQuery()

   * @param args
   * @return
   */
  protected static List executeQuery(String hql, int fromIdx, int fetchCount, Object[] args){
    Session ssn = getSession();
    Query q = ssn.createQuery(hql);
    for(int i=0;args!=null&&i<args.length;i++){
      q.setParameter(i, args[i]);
    }
    if(fromIdx > 0)
      q.setFirstResult(fromIdx);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.