Example usage for org.springframework.jdbc.core BeanPropertyRowMapper BeanPropertyRowMapper

List of usage examples for org.springframework.jdbc.core BeanPropertyRowMapper BeanPropertyRowMapper

Introduction

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

Prototype

public BeanPropertyRowMapper(Class<T> mappedClass) 

Source Link

Document

Create a new BeanPropertyRowMapper , accepting unpopulated properties in the target bean.

Usage

From source file:konditer.client.dao.DeliveryDao.java

@Override
public Delivery getDelivery(int deliveryId) {
    String SQL_QUERY = "SELECT DELIVERY_ID, " + "DELIVERY_NAME, " + "DELIVERY_PRICE, " + "TIMESTAMP "
            + "FROM deliveries " + "WHERE DELIVERY_ID = ?";
    Delivery delivery = (Delivery) jdbcTemplate.queryForObject(SQL_QUERY, new Object[] { deliveryId },
            new BeanPropertyRowMapper(Delivery.class));
    return delivery;
}

From source file:konditer.client.dao.ContactTypeDao.java

@Override
public ContactType getContactType(int contactTypeId) {
    String SQL_QUERY = "SELECT CONTACT_TYPE_ID, CONTACT_TYPE_NAME, TIMESTAMP " + "FROM contact_types "
            + "WHERE CONTACT_TYPE_ID = ? ";

    ContactType contType = (ContactType) jdbcTemplate.queryForObject(SQL_QUERY, new Object[] { contactTypeId },
            new BeanPropertyRowMapper(ContactType.class));
    return contType;
}

From source file:just.aRest.project.DAO.ApplDAOImpl.java

@Override
public Application getByUsername(String username) {
    //get the application that the user requested,criteria : 1: username , 2: application is not online 
    String query = "SELECT app_code,amount,repayTime,buy_type,drivers_license,taxes,tekmiriwsi,status,accepted,username "
            + "FROM Application WHERE username= ? AND isOnline=0 AND status =1 AND accepted=1 LIMIT 1";
    try {/* ww  w. j av  a 2  s.c o m*/
        //open jdbc connection
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
        //get an object with the requested application
        Object queryForObject = jdbcTemplate.queryForObject(query, new Object[] { username },
                new BeanPropertyRowMapper<Application>(Application.class));
        //Create an application object and return it
        Application app = (Application) queryForObject;
        return app;
    } catch (EmptyResultDataAccessException e) {
        //if no results returned , create an empty application and sent it
        Application app = new Application(0, 0, 0, "", "", 0, "", 0, 0, "");
        return app;
    }
}

From source file:com.sirti.microservice.hbase.dao.UnicoStoricoDaoImpl.java

@Override
public List<UnicoStorico> findAll() {
    String sql = "SELECT * FROM " + hKpiTable + " LIMIT 500";
    List<UnicoStorico> alarms = this.jdbcTemplate.query(sql,
            new BeanPropertyRowMapper<UnicoStorico>(UnicoStorico.class));
    return alarms;
}

From source file:konditer.client.dao.OrdereStatusDao.java

@Override
public OrdereStatus getOrdereStatus(int orderStatusId) {
    String SQL_QUERY = "SELECT ORDER_STATUS_ID, ORDER_STATUS_NAME, TIMESTAMP " + "FROM order_statuses "
            + "WHERE ORDER_STATUS_ID = ?";
    OrdereStatus ordereStatus = (OrdereStatus) jdbcTemplate.queryForObject(SQL_QUERY,
            new Object[] { orderStatusId }, new BeanPropertyRowMapper(OrdereStatus.class));
    return ordereStatus;
}

From source file:com.anthony.forumspring.dao.CommentaireDao.java

@Override
public List<Commentaire> findAllByIdTopics(int topic_id) {
    String sql = "Select * from commentaires where topic_id = " + topic_id + " order by comment_id desc";
    return this.jdbcTemplate.query(sql, new BeanPropertyRowMapper(Commentaire.class));

}

From source file:com.anthony.forumspring.dao.CategorieDao.java

@Override
public List<Categorie> findNamebyId(int cat_id) {
    String sql = "SELECT cat_nom FROM CATEGORIE WHERE cat_id = " + cat_id;

    return jdbcTemplate.query(sql, new BeanPropertyRowMapper(Categorie.class));
}

From source file:konditer.client.dao.CakeInsideDao.java

@Override
public CakeInside getCakeInside(int cakeInsideId) {
    String SQL_QUERY = "SELECT CAKE_INSIDE_ID, " + "CAKE_INSIDE_NAME, " + "CAKE_INSIDE_DATA, "
            + "CAKE_INSIDE_IMAGE, " + "CAKE_INSIDE_PRICE, " + "TIMESTAMP " + "FROM cake_insides "
            + "WHERE CAKE_INSIDE_ID = ?";
    CakeInside cakeInside = (CakeInside) jdbcTemplate.queryForObject(SQL_QUERY, new Object[] { cakeInsideId },
            new BeanPropertyRowMapper(CakeInside.class));
    return cakeInside;
}

From source file:Spring.Repaso01.ClienteDAO.java

@Override
public Cliente consulta(int idCliente) {
    String selQuery = "select * from Cliente where idCliente = ?";
    Cliente cliente = (Cliente) jdbcTemplate.queryForObject(selQuery, new Object[] { idCliente },
            new BeanPropertyRowMapper(Cliente.class));
    return cliente;
}

From source file:Spring.Repaso02.ClienteDAO.java

@Override
public Cliente consulta(String idCliente) {
    String selQuery = "select * from TClientes where idCliente = ?";
    Cliente cliente = (Cliente) jdbcTemplate.queryForObject(selQuery, new Object[] { idCliente },
            new int[] { Types.VARCHAR }, new BeanPropertyRowMapper(Cliente.class));
    return cliente;
}