Examples of addScalar()


Examples of org.hibernate.SQLQuery.addScalar()

    Session session = Helper.getHibernateSession();
    SQLQuery query = session.createSQLQuery(natSQL);

    // needs to be there otherwise an exception is thrown
    query.addScalar("minStep", StandardBasicTypes.DOUBLE);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    if (list != null && list.size() > 0 && list.get(0) != null) {
View Full Code Here

Examples of org.hibernate.SQLQuery.addScalar()

    Session session = Helper.getHibernateSession();

    SQLQuery query = session.createSQLQuery(natSQL);

    // needs to be there otherwise an exception is thrown
    query.addScalar("volumes", StandardBasicTypes.INTEGER);
    query.addScalar("pages", StandardBasicTypes.INTEGER);
    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();
View Full Code Here

Examples of org.hibernate.SQLQuery.addScalar()

    SQLQuery query = session.createSQLQuery(natSQL);

    // needs to be there otherwise an exception is thrown
    query.addScalar("volumes", StandardBasicTypes.INTEGER);
    query.addScalar("pages", StandardBasicTypes.INTEGER);
    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();
View Full Code Here

Examples of org.hibernate.SQLQuery.addScalar()

    SQLQuery query = session.createSQLQuery(natSQL);

    // needs to be there otherwise an exception is thrown
    query.addScalar("volumes", StandardBasicTypes.INTEGER);
    query.addScalar("pages", StandardBasicTypes.INTEGER);
    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    StringBuilder title = new StringBuilder(StatisticsMode.PRODUCTION.getTitle());
View Full Code Here

Examples of org.hibernate.SQLQuery.addScalar()

    Session session = sessionFactory.openSession();
    try {
      for (String tableName : tableNames) {
        String countSql = "select count(*) as RECORD_COUNT_ from "+tableName;
        SQLQuery sqlQuery = session.createSQLQuery(countSql);
        sqlQuery.addScalar("RECORD_COUNT_", Hibernate.LONG);
        Long recordCount = (Long) sqlQuery.uniqueResult();
        if (recordCount>0L) {
          recordsLeftMsg += tableName+":"+recordCount+", ";
        }
      }
View Full Code Here

Examples of org.hibernate.SQLQuery.addScalar()

        .addProperty( "element.employmentId", "empId" )
        .addProperty( "element.salary" ).addColumnAlias( "VALUE" ).addColumnAlias( "CURRENCY" );
    sqlQuery.list();

    // lets try a totally different approach now and pull back scalars, first with explicit types
    sqlQuery.addScalar( "orgid", LongType.INSTANCE )
        .addScalar( "name", StringType.INSTANCE )
        .addScalar( "empid", LongType.INSTANCE )
        .addScalar( "employee", LongType.INSTANCE )
        .addScalar( "startDate", TimestampType.INSTANCE )
        .addScalar( "endDate", TimestampType.INSTANCE )
View Full Code Here

Examples of org.hibernate.SQLQuery.addScalar()

                    }
                }

                if (scalars != null) {
                    for (String key : scalars.keySet()) {
                        query.addScalar(key, scalars.get(key));
                    }
                }

                if (aliasClass != null) {
                    if (aliasClass.equals(Map.class)) {
View Full Code Here

Examples of org.hibernate.ogm.query.NoSQLQuery.addScalar()

    session.close();
  }

  private void assertCountQueryResult(OgmSession session, String queryString, long expectedCount) {
    NoSQLQuery query = session.createNativeQuery( queryString );
    query.addScalar( "n" );
    long actualCount = (Long) query.list().iterator().next();
    assertThat( actualCount ).describedAs( "Count query didn't yield expected result" ).isEqualTo( expectedCount );
  }

  @Override
View Full Code Here

Examples of org.hibernate.ogm.query.NoSQLQuery.addScalar()

    session.close();
  }

  private void assertCountQueryResult(OgmSession session, String queryString, long expectedCount) {
    NoSQLQuery query = session.createNativeQuery( queryString );
    query.addScalar( "n" );
    long actualCount = (Long) query.list().iterator().next();
    assertThat( actualCount ).describedAs( "Count query didn't yield expected result" ).isEqualTo( expectedCount );
  }

  @Override
View Full Code Here

Examples of org.hibernate.ogm.query.NoSQLQuery.addScalar()

    // Register the result types of the query; Currently either a number of scalar values or an entity return
    // are supported only; JP-QL would actually a combination of both, though (see OGM-514)
    if ( result.getProjection() != null ) {
      for ( String field : result.getProjection().keySet() ) {
        query.addScalar( field );
      }
    }
    else {
      query.addEntity( result.getEntityType() );
    }
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.