List of usage examples for org.springframework.jdbc.core BeanPropertyRowMapper newInstance
public static <T> BeanPropertyRowMapper<T> newInstance(Class<T> mappedClass)
From source file:com.branded.holdings.qpc.repository.jdbc.JdbcTopicRepositoryImpl.java
@Override public List<EmotionType> findEmotionTypes() throws DataAccessException { Map<String, Object> params = new HashMap<String, Object>(); return this.namedParameterJdbcTemplate.query("SELECT id, name FROM emotiontype ORDER BY id", params, BeanPropertyRowMapper.newInstance(EmotionType.class)); }
From source file:kniznica.SQLFilm.java
@Override public List<Film> dajVsetkychZID(String id) { String sql = "SELECT * FROM filmy where id = " + id; BeanPropertyRowMapper<Film> mapper = BeanPropertyRowMapper.newInstance(Film.class); return jdbcTemplate.query(sql, mapper); }
From source file:sk.upjs.ics.autobazar.MySqlInzeratNakladneDao.java
@Override public List<InzeratNakladne> dajPodlaPouzivatela(Long idP) { String sql = "SELECT * FROM inzeratNakladne where idP = ?"; BeanPropertyRowMapper<InzeratNakladne> mapper = BeanPropertyRowMapper.newInstance(InzeratNakladne.class); return jdbcTemplate.query(sql, mapper, idP); }
From source file:com.concur.dao.HostDaoImpl.java
public EntityInfo getEntityKey(String entity) { if (entity == null || entity.equals("")) return null; System.out.println("get entity key for:" + entity); // System.out.println("hostdb="+jdbcTemplate.getDataSource().toString()); /*/*from w w w.j av a2 s . c o m*/ String sql = "SELECT entity_key from dbo.cth_entity where entity_code = ?"; Integer entityKey = jdbcTemplate.queryForObject(sql, new Object[] { entity}, Integer.class); return (entityKey != null?entityKey.intValue():-1); */ String sql = "select e.entity_key, e.entity_code, server_name, " + "schema_name, user_name username, user_passw password " + "from cth_entity e " + "join CTH_DB_CONN_MAP dcm on dcm.entity_key = e.ENTITY_KEY " + "join CTH_APPLICATION a on a.APP_KEY = dcm.APP_KEY " + "where e.ENTITY_CODE = ? " + "and a.NAME = 'Reporting'"; return (EntityInfo) jdbcTemplate.queryForObject(sql, new Object[] { entity }, BeanPropertyRowMapper.newInstance(EntityInfo.class)); }
From source file:kniznica.SQLFilm.java
@Override public List<Film> dajTop10() { String sql = "SELECT * FROM filmy order by hodnotenie desc limit 10"; BeanPropertyRowMapper<Film> mapper = BeanPropertyRowMapper.newInstance(Film.class); return jdbcTemplate.query(sql, mapper); }
From source file:com.branded.holdings.qpc.repository.jdbc.JdbcPetRepositoryImpl.java
@Override public List<PetType> findPetTypes() throws DataAccessException { Map<String, Object> params = new HashMap<String, Object>(); return this.namedParameterJdbcTemplate.query("SELECT id, name FROM types ORDER BY name", params, BeanPropertyRowMapper.newInstance(PetType.class)); }
From source file:kniznica.SQLFilm.java
@Override public List<Film> dajNajnov10() { String sql = "SELECT * FROM filmy order by id desc limit 10"; BeanPropertyRowMapper<Film> mapper = BeanPropertyRowMapper.newInstance(Film.class); return jdbcTemplate.query(sql, mapper); }
From source file:com.branded.holdings.qpc.repository.jdbc.JdbcOwnerRepositoryImpl.java
/** * Loads {@link Owner Owners} from the data store by last name, returning all owners whose last name <i>starts</i> with * the given name; also loads the {@link Pet Pets} and {@link Visit Visits} for the corresponding owners, if not * already loaded.// w ww . j a v a 2 s . co m */ @Override public Collection<Owner> findByLastName(String lastName) throws DataAccessException { Map<String, Object> params = new HashMap<String, Object>(); params.put("lastName", lastName + "%"); List<Owner> owners = this.namedParameterJdbcTemplate.query( "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE last_name like :lastName", params, BeanPropertyRowMapper.newInstance(Owner.class)); loadOwnersPetsAndVisits(owners); return owners; }
From source file:com.concur.dao.ArchiveRunDaoImpl.java
@Override public Collection<ArchiveRun> findArchiveRun(String entity) throws DataAccessException { EntityInfo entityInfo = hostDaoImpl.getEntityKey(entity); jdbcTemplate = new JdbcTemplate(getDataSource(entityInfo)); return this.jdbcTemplate.query("SELECT etl_batch_key job_key, etl_status job_status, " + "DATEDIFF(MINUTE, etl_start_dttm, etl_end_dttm) job_duration " + "FROM dbo.dim_etl_batch " + "WHERE job_type = 'DW_GEXP_ARCHIVE' " + "AND etl_status NOT IN ('RUNNING') " + "ORDER BY etl_batch_key", BeanPropertyRowMapper.newInstance(ArchiveRun.class)); }
From source file:com.branded.holdings.qpc.repository.jdbc.JdbcOwnerRepositoryImpl.java
/** * Loads the {@link Owner} with the supplied <code>id</code>; also loads the {@link Pet Pets} and {@link Visit Visits} * for the corresponding owner, if not already loaded. *//* w w w .j av a 2s . c om*/ @Override public Owner findById(int id) throws DataAccessException { Owner owner; try { Map<String, Object> params = new HashMap<String, Object>(); params.put("id", id); owner = this.namedParameterJdbcTemplate.queryForObject( "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE id= :id", params, BeanPropertyRowMapper.newInstance(Owner.class)); } catch (EmptyResultDataAccessException ex) { throw new ObjectRetrievalFailureException(Owner.class, id); } loadPetsAndVisits(owner); return owner; }