Package org.hibernate

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


    }
    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

    }
    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

    }
    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

   */
  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

   */
  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

   */
  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

   * @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

   * @param args
   * @return
   */
  protected static int executeUpdate(String hql, 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]);
    }
    return q.executeUpdate();
  }
View Full Code Here

   */
  protected static int commitUpdate(String hql, Object[] args){
    try{
      Session ssn = getSession();
      beginTransaction();
      Query q = ssn.createQuery(hql);
      for(int i=0;args!=null&&i<args.length;i++){
        q.setParameter(i, args[i]);
      }
      int er = q.executeUpdate();
      commit();
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.