Examples of createQuery()


Examples of org.hibernate.Session.createQuery()

    if(date>0){
      hql.append(" AND p.date=:date");
    }
    Session ssn = getSession();
    try{
      Query q = ssn.createQuery(hql.toString());
      q.setInteger("site", site.getId());
      if(album_id > 0)
        q.setInteger("album", album_id);
      if(month_stamp > 190000 && month_stamp < 209912){
        q.setInteger("year", month_stamp / 100);
View Full Code Here

Examples of org.hibernate.Session.createQuery()

      return -1;
    StringBuffer hql = new StringBuffer("SELECT SUM(p.photoInfo.size) FROM PhotoBean AS p WHERE p.site.id=?");
    if(album_id > 0)
      hql.append(" AND p.album.id=?");
    Session ssn = getSession();
    Query q = ssn.createQuery(hql.toString());
    q.setInteger(0, sid);
    if(album_id > 0)
      q.setInteger(1, album_id);
    try{
      Number size = (Number)q.uniqueResult();
View Full Code Here

Examples of org.hibernate.Session.createQuery()

      hql.append(" AND p.album.id=:album");
    if(month >= 190001 && month <= 209912){
      hql.append(" AND p.year = :year AND p.month = :month");
    }
    Session ssn = getSession();
    Query q = ssn.createQuery(hql.toString());
    q.setInteger("site", sid);
    if(album_id > 0)
      q.setInteger("album", album_id);
    if(month >= 190001 && month <= 209912){
      q.setInteger("year", month / 100);
View Full Code Here

Examples of org.hibernate.Session.createQuery()

      hql.append(" AND j.status=:status AND j.album.type=:album_type");
    }
       
    try{
      Session ssn = getSession();
      Query q = ssn.createQuery(hql.toString()).setCacheable(true);
      q.setTimestamp("beginTime", firstDate.getTime());
      q.setTimestamp("endTime", nextMonthFirstDate.getTime());
      q.setInteger("site", site.getId());
      if(!is_owner){
        q.setInteger("status", PhotoBean.STATUS_NORMAL);
View Full Code Here

Examples of org.hibernate.Session.createQuery()

      hql.append(" AND r.photo.album.type=:album_type");
      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", PhotoReplyBean.STATUS_NORMAL);
    q.setInteger("photo_status", PhotoBean.STATUS_NORMAL);
    q.setInteger("site", site.getId());
    if(!is_owner){
      q.setInteger("album_type", AlbumBean.TYPE_PUBLIC);
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<bookmarkIds.length;i++){
        String s_id = (String)bookmarkIds[i];
        int id = -1;
View Full Code Here

Examples of org.hibernate.StatelessSession.createQuery()

            }

            protected void renderResponse() throws Exception {
                StatelessSession ss = getStatelessSession();
                List<String> uploads =
                        ss.createQuery("select wu.filename from WikiUpload wu where wu.parent.id = :parent order by wu.createdOn desc ")
                        .setParameter("parent" , 2l).list();

                assert uploads.size() == 3;
                assert uploads.get(0).equals("testupload2.zip");
            }
View Full Code Here

Examples of org.hibernate.classic.Session.createQuery()

      transaction = session.beginTransaction();
      // TODO: this is not the most efficient loop (opening/closing file)
      for (Iterator iter = queryStrings.iterator(); iter.hasNext();) {
        String query = (String) iter.next();
       
        List list = session.createQuery(query).list();
       
        if(getFileName()!=null) {
          PrintWriter pw = null;
          try {
            File file = new File( getOutputDirectory(), getFileName() );
View Full Code Here

Examples of org.hibernate.engine.spi.SessionImplementor.createQuery()

    }
  }

  protected <T> TypedQuery<T> createNamedJpqlQuery(NamedQueryDefinition namedQueryDefinition, Class<T> resultType) {
    SessionImplementor session = (SessionImplementor) getDelegate();
    final org.hibernate.Query query = session.createQuery( namedQueryDefinition );
    if ( resultType != null ) {
      resultClassChecking( resultType, query );
    }

    return wrapAsJpaQuery( namedQueryDefinition, query );
View Full Code Here

Examples of org.hibernate.envers.AuditReader.createQuery()

    }

    private void printPersonHistory(StringBuilder sb, int personId) {
        AuditReader reader = AuditReaderFactory.get(entityManager);

        List personHistory = reader.createQuery()
                .forRevisionsOfEntity(Person.class, false, true)
                .add(AuditEntity.id().eq(personId))
                .getResultList();

        if (personHistory.size() == 0) {
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.