Examples of createSQLQuery()


Examples of com.liferay.portal.kernel.dao.orm.Session.createSQLQuery()

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(COUNT_BY_G1_G2_U1_U2);

      SQLQuery q = session.createSQLQuery(sql);

      q.addScalar(COUNT_COLUMN_NAME, Type.LONG);

      QueryPos qPos = QueryPos.getInstance(q);
View Full Code Here

Examples of com.liferay.portal.kernel.dao.orm.Session.createSQLQuery()

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_G1_G2_U1_U2);

      SQLQuery q = session.createSQLQuery(sql);

      q.addEntity("SN_WallEntry", WallEntryImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

    Session ssn = getSession();
    StringBuffer sql = new StringBuffer("SELECT tag_name,COUNT(*) FROM dlog_tag");
    if(site>0)
      sql.append(" WHERE site_id=?");
    sql.append(" GROUP BY tag_name ORDER BY 2 DESC");
    SQLQuery query = ssn.createSQLQuery(sql.toString());
    if(site>0)
      query.setInteger(0, site);
    query.setMaxResults(count);
    List tags = new ArrayList();
    List results = query.list();
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

    Session session = openSession();
    Transaction transaction = session.beginTransaction();

    String nativeQuery = "MATCH ( n:" + TABLE_NAME + " { author:'Oscar Wilde' } ) RETURN n ORDER BY n.name DESC";
    @SuppressWarnings("unchecked")
    List<OscarWildePoem> result = session.createSQLQuery( nativeQuery )
        .addEntity( OscarWildePoem.TABLE_NAME, OscarWildePoem.class )
        .setFirstResult( 1 )
        .setMaxResults( 1 )
        .list();
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

                for (Object o : resultList) {
                    Documents actor = (Documents) o;
                    System.out.println(actor.getTitle());
                }

                Query q1 = session.createSQLQuery("update Documents set title='qwe' where id=1;");
                q1.executeUpdate();

                session.getTransaction().commit();
            } catch (HibernateException he) {
                he.printStackTrace();
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

    Session session = getSession();
    org.hibernate.Transaction tx = beginTransaction();
    try {
      String stringQuery = "DELETE FROM PRACOWNIK "
                + "WHERE imie LIKE :param ";
      Query query = session.createSQLQuery(stringQuery);
      query.setString("param", param+"%");
      query.executeUpdate();
      commit(tx);
    } catch (HibernateException e) {
      rollback(tx);
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

  }
 
  public int batchUpdateByNativeQuery(String queryString, Object[] params, Type[] types) {
    logger.debug("Batch Native Update[{}]",queryString);
    Session session = getSession();
    SQLQuery query = session.createSQLQuery(queryString);
    if(params != null && params.length > 0){
      for(int i=0; i< params.length; i++){
        logger.debug("{}) : {} [{}]", new Object[]{i+1, params[i], types[i]});
        query.setParameter(i, params[i], types[i]);
      }
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

    return query.executeUpdate();
  }

  public void executeDDL(String queryString) {
    Session session = getSession();
    SQLQuery query = session.createSQLQuery(queryString);
    query.executeUpdate();
 
 
  private class InnerStoreProcedure extends StoredProcedure {
      public InnerStoreProcedure(String spName, SqlParameter[] parameters){
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

    String natSQL = new SQLStorage(this.timeFilterFrom, this.timeFilterTo,
        this.timeGrouping, IDlist).getSQL();

    Session session = Helper.getHibernateSession();

    SQLQuery query = session.createSQLQuery(natSQL);

    //needs to be there otherwise an exception is thrown
    query.addScalar("storage", StandardBasicTypes.DOUBLE);
    query.addScalar("intervall", StandardBasicTypes.STRING);
View Full Code Here

Examples of org.hibernate.Session.createSQLQuery()

      String stepName = step.getTitle();
      headerRow.setName("header - delete again");
      headerRow.addValue(stepName, Double.parseDouble("0"));
    }

    SQLQuery query = session.createSQLQuery(natSQL);

    // needs to be there otherwise an exception is thrown
    query.addScalar("stepCount", StandardBasicTypes.DOUBLE);
    query.addScalar("stepName", StandardBasicTypes.STRING);
    query.addScalar("intervall", StandardBasicTypes.STRING);
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.