List of usage examples for org.springframework.jdbc.core.namedparam BeanPropertySqlParameterSource BeanPropertySqlParameterSource
public BeanPropertySqlParameterSource(Object object)
From source file:org.openlmis.performancetesting.dao.FacilityDAO.java
public long insertFacility(Facility facility) { GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); template.update(insertFacilityQuery, new BeanPropertySqlParameterSource(facility), keyHolder, new String[] { "id" }); long id = keyHolder.getKey().longValue(); facility.setId(id);//from w w w .j av a 2 s .co m logger.info("facility id {}", id); return id; }
From source file:airport.database.dispatcher.airplane.FlightDaoImpl.java
@Override public void removeFlight(Flight flight) { SqlParameterSource parameterFlight = new BeanPropertySqlParameterSource(flight); jdbcTemplate.update(SQL_QUERY_REMOVE_FLIGT, parameterFlight); if (LOG.isInfoEnabled()) { LOG.info("remove flight. Flight: " + (flight != null ? flight.toString() : "")); }// ww w . ja va2s .c om }
From source file:org.smigo.species.vernacular.JdbcVernacularDao.java
@Override public int insertVernacular(Vernacular vernacular) { SqlParameterSource parameterSource = new BeanPropertySqlParameterSource(vernacular); return insertVernacular.executeAndReturnKey(parameterSource).intValue(); }
From source file:org.openlmis.performancetesting.dao.ProductDAO.java
public long insertProduct(Product product) { GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); template.update(insertProductQuery, new BeanPropertySqlParameterSource(product), keyHolder, new String[] { "id" }); long autoGeneratedKey = keyHolder.getKey().longValue(); product.setId(autoGeneratedKey);/*from w w w.j a va2 s. co m*/ return keyHolder.getKey().longValue(); }
From source file:net.noday.cat.dao.UserDao.java
public List<User> findPage(User condition, int pIndex, int pSize) { StringBuffer sql = new StringBuffer("select * from user u where 1=1"); SqlParameterSource ps = null;/*from www . j a v a 2 s . c o m*/ if (condition != null) { ps = new BeanPropertySqlParameterSource(condition); sql.append(toConditionSql(condition)); } sql.append(" order by u.regist_time desc").append(" limit ").append((pIndex - 1) * pSize).append(",") .append(pSize); List<User> list = namedJdbcTemplate.query(sql.toString(), ps, new BeanPropertyRowMapper<User>(User.class)); return list; }
From source file:org.smigo.message.JdbcMessageDao.java
@Override public int addMessage(MessageAdd message) { return insert.executeAndReturnKey(new BeanPropertySqlParameterSource(message)).intValue(); }
From source file:org.openlmis.performancetesting.dao.RequisitionGroupDAO.java
public long insertRequisitionGroupProgramSchedule( RequisitionGroupProgramSchedule requisitionGroupProgramSchedule) { GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); template.update(insertRequisitionGroupProgramScheduleQuery, new BeanPropertySqlParameterSource(requisitionGroupProgramSchedule), keyHolder, new String[] { "id" }); long id = keyHolder.getKey().longValue(); requisitionGroupProgramSchedule.setId(id); return id;//from ww w. j a v a 2 s .c o m }
From source file:org.openlmis.performancetesting.dao.LineItemDAO.java
public long insertLineItem(RnrLineItem lineItem) { GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); template.update(insertLineItemQuery, new BeanPropertySqlParameterSource(lineItem), keyHolder, new String[] { "id" }); long id = keyHolder.getKey().longValue(); lineItem.setId(id);/* w w w .j av a 2 s . com*/ return id; }
From source file:org.openlmis.performancetesting.dao.UserDAO.java
public void insertRoleAssignment(RoleAssignment roleAssignment) { template.update(insertRoleAssignmentQuery, new BeanPropertySqlParameterSource(roleAssignment)); }
From source file:org.smigo.plants.JdbcPlantDao.java
@Override public int addPlant(Plant plant) { SqlParameterSource parameterSource = new BeanPropertySqlParameterSource(plant); return insertPlant.executeAndReturnKey(parameterSource).intValue(); }