Example usage for org.springframework.jdbc.core.namedparam MapSqlParameterSource MapSqlParameterSource

List of usage examples for org.springframework.jdbc.core.namedparam MapSqlParameterSource MapSqlParameterSource

Introduction

In this page you can find the example usage for org.springframework.jdbc.core.namedparam MapSqlParameterSource MapSqlParameterSource.

Prototype

public MapSqlParameterSource(String paramName, @Nullable Object value) 

Source Link

Document

Create a new MapSqlParameterSource, with one value comprised of the supplied arguments.

Usage

From source file:com.eu.evaluation.server.dao.entity.space.area.AreaOrgDAO.java

public int removeByPosition(String sysKey) {
    String sql = "delete from AreaOrg t where t.position = :position";
    MapSqlParameterSource params = new MapSqlParameterSource("position", sysKey);
    return this.remove(sql, params);
}

From source file:com.eu.evaluation.server.dao.entity.space.station.StationOrgDAO.java

public int removeByPosition(String sysKey) {
    String sql = "delete from StationOrg t where t.position = :position";
    MapSqlParameterSource params = new MapSqlParameterSource("position", sysKey);
    return this.remove(sql, params);
}

From source file:com.eu.evaluation.server.dao.sys.SystemParamsDAO.java

public SystemParams findByName(String name) {
    String jpql = "select t from SystemParams t where t.name = :name";
    MapSqlParameterSource params = new MapSqlParameterSource("name", name);
    List<SystemParams> result = this.query(jpql, params);
    if (result.isEmpty()) {
        return null;
    } else if (result.size() == 1) {
        return result.get(0);
    } else {//from www.ja  v  a2  s  .co m
        throw new RuntimeException("??? " + name + " ???");
    }
}

From source file:com.eu.evaluation.server.dao.eva.history.EvaluateSystemDAO.java

public int removeByEvaluateVersion(String evid) {
    String jpql = "delete from EvaluateSystem t where t.evaluateVersion.id = :evid";
    MapSqlParameterSource params = new MapSqlParameterSource("evid", evid);
    return this.createQuery(jpql, params).executeUpdate();
}

From source file:com.eu.evaluation.server.dao.entity.space.deviceroom.DeviceroomOrgDAO.java

public int removeByPosition(String sysKey) {
    String sql = "delete from DeviceRoomOrg t where t.position = :position";
    MapSqlParameterSource params = new MapSqlParameterSource("position", sysKey);
    return this.remove(sql, params);
}

From source file:com.eu.evaluation.server.dao.sys.AccessSystemDAO.java

public AccessSystem findByCode(String code) {
    String jpql = "select t from AccessSystem t where t.code = :code";
    MapSqlParameterSource params = new MapSqlParameterSource("code", code);
    try {//from   w ww  . jav a  2 s  .  c  o  m
        return (AccessSystem) this.createQuery(jpql, params).getSingleResult();
    } catch (NoResultException e) {
        return null;
    }
}

From source file:com.neeti.neg.dao.impl.GamesDaoImpl.java

@Override
public int getGameId(String gameRefId) {
    SqlParameterSource namedParameters = new MapSqlParameterSource("game_reqid", gameRefId);
    int temp = 0;
    try {//from  w  ww. ja  v  a 2  s. c  o m
        temp = this.namedParameterJdbcTemplate.queryForInt(SQL_GETGAMEREF, namedParameters);
    } catch (Exception e) {
        temp = 0;
    } finally {
        //status=(boolean) temp;
        return temp;

    }
}

From source file:com.eu.evaluation.server.dao.dictionary.ObjectDictionaryDAO.java

public List<ObjectDictionary> findAndOrder() {
    String jpql = "select t from ObjectDictionary t where t.valid = :valid order by t.serial";
    MapSqlParameterSource params = new MapSqlParameterSource("valid", true);
    return this.query(jpql, params);
}

From source file:com.eu.evaluation.server.dao.eva.history.EvaluateItemHistoryDAO.java

/**
 * ?//from www.j a v a 2 s. co m
 * @param ev
 * @return 
 */
public List<EvaluateItemHistory> find(EvaluateVersion ev) {
    String jpql = "select t from EvaluateItemHistory t where t.evaluateVersion.id = :evID";
    MapSqlParameterSource params = new MapSqlParameterSource("evID", ev.getId());
    return this.query(jpql, params);
}

From source file:com.eu.evaluation.server.dao.dictionary.ObjectRelationDAO.java

/**
 * // w  w  w .j  a  va 2  s . c  o  m
 * @param selfClassID
 * @param parentClassID
 * @return 
 */
public ObjectRelation findByParent(String selfClass, String relationClass) {
    String jpql = "select t from ObjectRelation t where t.selfClass = :selfClass and t.relationClass = :relationClass";
    MapSqlParameterSource params = new MapSqlParameterSource("selfClass", selfClass);
    params.addValue("relationClass", relationClass);
    List<ObjectRelation> result = this.query(jpql, params);
    if (result.isEmpty()) {
        return null;
    } else if (result.size() == 1) {
        return result.get(0);
    } else {
        throw new RuntimeException("?? = " + selfClass + " ;  = "
                + selfClass + "?????");
    }
}