Example usage for org.hibernate SQLQuery setLong

List of usage examples for org.hibernate SQLQuery setLong

Introduction

In this page you can find the example usage for org.hibernate SQLQuery setLong.

Prototype

@Deprecated
@SuppressWarnings("unchecked")
default Query<R> setLong(int position, long val) 

Source Link

Document

Bind a positional long-valued parameter.

Usage

From source file:com.dungnv.streetfood.business.DishArticleBusiness.java

License:Open Source License

@Override
public List<DishDTO> getListDishByArticle(String userName, String localeCode, String countryCode, String token,
        String id) {/* ww w .j  a  v  a2s.c  om*/
    SQLQuery query = gettDAO().getSession().createSQLQuery("select c.id, c.name from dish c "
            + " inner join dish_article l on c.id =l.dish_id" + " where l.article_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.addScalar("name", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    query.setResultTransformer(Transformers.aliasToBean(DishDTO.class));
    return query.list();
}

From source file:com.dungnv.streetfood.business.RestaurantArticleBusiness.java

License:Open Source License

@Override
public List<ArticleDTO> getListArticleByRestaurant(String userName, String localeCode, String countryCode,
        String token, String id) {
    SQLQuery query = gettDAO().getSession().createSQLQuery("select c.id, c.name from article c "
            + " inner join restaurant_article l on c.id = l.article_id" + " where l.restaurant_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.addScalar("name", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    query.setResultTransformer(Transformers.aliasToBean(ArticleDTO.class));
    return query.list();
}

From source file:com.dungnv.streetfood.business.RestaurantArticleBusiness.java

License:Open Source License

@Override
public List<RestaurantDTO> getListRestaurantByArticle(String userName, String localeCode, String countryCode,
        String token, String id) {
    SQLQuery query = gettDAO().getSession().createSQLQuery("select c.id, c.name from restaurant c "
            + " inner join restaurant_article l on c.id =l.restaurant_id" + " where l.article_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.addScalar("name", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    query.setResultTransformer(Transformers.aliasToBean(RestaurantDTO.class));
    return query.list();
}

From source file:com.dungnv.streetfood.business.RestaurantDishDetailBusiness.java

License:Open Source License

@Override
public List<RestaurantDTO> getListRestaurantByDish(String userName, String localeCode, String countryCode,
        String token, String id) {
    SQLQuery query = gettDAO().getSession().createSQLQuery("select c.id, c.name from restaurant c "
            + " inner join restaurant_dish_detail l on c.id = l.restaurant_id" + " where l.dish_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.addScalar("name", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    query.setResultTransformer(Transformers.aliasToBean(RestaurantDTO.class));
    return query.list();
}

From source file:com.dungnv.streetfood.business.RestaurantDishDetailBusiness.java

License:Open Source License

@Override
public List<DishDTO> getListDishByRestaurant(String userName, String localeCode, String countryCode,
        String token, String id) {
    SQLQuery query = gettDAO().getSession().createSQLQuery("select c.id, c.name from dish c "
            + " inner join restaurant_dish_detail l on c.id =l.dish_id" + " where l.restaurant_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.addScalar("name", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    query.setResultTransformer(Transformers.aliasToBean(DishDTO.class));
    return query.list();
}

From source file:com.dungnv.streetfood.business.TagArticleBusiness.java

License:Open Source License

@Override
public List<String> getTagsListByArticle(String userName, String localeCode, String countryCode, String token,
        String id) {/*from   ww  w. j av a 2s.  c  om*/
    SQLQuery query = gettDAO().getSession().createSQLQuery("select t.name id from tags t "
            + "inner join tag_article l on t.id =l.tag_id" + " where l.article_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    return query.list();
}

From source file:com.dungnv.streetfood.business.TagCategoryBusiness.java

License:Open Source License

@Override
public List<String> getTagsListByCategory(String userName, String localeCode, String countryCode, String token,
        String id) {// www  . jav a2  s  . c  om
    SQLQuery query = gettDAO().getSession().createSQLQuery("select t.name id from tags t "
            + "inner join tag_category l on t.id =l.tag_id" + " where l.category_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    return query.list();
}

From source file:com.dungnv.streetfood.business.TagDishBusiness.java

License:Open Source License

@Override
public List<String> getTagsListByDish(String userName, String localeCode, String countryCode, String token,
        String id) {//from   ww  w .  j  a  v a  2 s.  co m
    SQLQuery query = gettDAO().getSession().createSQLQuery("select t.name id from tags t "
            + "inner join tag_dish l on t.id =l.tag_id" + " where l.dish_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    return query.list();
}

From source file:com.dungnv.streetfood.business.TagRestaurantBusiness.java

License:Open Source License

@Override
public List<String> getTagsListByRestaurant(String userName, String localeCode, String countryCode,
        String token, String id) {
    SQLQuery query = gettDAO().getSession().createSQLQuery("select t.name id from tags t "
            + "inner join tag_restaurant l on t.id =l.tag_id" + " where l.restaurant_id = ? ");
    query.addScalar("id", StringType.INSTANCE);
    query.setLong(0, Long.valueOf(id));
    return query.list();
}

From source file:com.globalsight.everest.workflow.WorkflowJbpmPersistenceHandler.java

License:Apache License

/**
  * Judges whether the user is rejected for the specified
  * <code>TaskInstance</code>. <br>
  * The rejected user will be stored in the table
  * <code>JBPM_GS_VARIABLE</code>.
  * //from w w  w.j a  va  2 s . c  o  m
  * @param ctx
  *            {@code JbpmContext}
  * @param userId
  *            the user id.
  * @param taskInstance
  *            {@code TaskInstance}
  * @return <code>true</code> when the user is reject by the specified
  *         taskinstance.
  */
public static boolean isUserRejected(JbpmContext ctx, String userId, TaskInstance taskInstance) {

    SQLQuery query = null;
    Session session = ctx.getSession();

    query = session.createSQLQuery(SqlHolder.isUserReject);

    query.setString(VARIABLE_NAME, WorkflowConstants.VARIABLE_IS_REJECTED);
    query.setString(CATEGORY, VARIABLE_CATEGORY_REJECT);
    query.setString(ACTOR_ID, userId);
    query.setLong(TASK_ID, taskInstance.getId());

    Number num = (Number) query.uniqueResult();

    return num == null ? false : num.longValue() > 0;

}