JPA
Using JpaRepository
JdbcTemplate operations
1.jdbcTemplate.query(qry, new BookMapper());----getting
2.jdbcTemplate.queryForObject
String qry="select * from book_master where book_id = ?";
return jdbcTemplate.queryForObject(qry, new BookMapper(),book_id);
3. jdbcTemplate.update
for adding
String qry="INSERT INTO book_master (book_name,book_author) VALUES(?,?)";
return jdbcTemplate.update(qry,book.getBook_name(),book.getBook_author());
String qry="UPDATE book_master set book_name=?,book_author=? where book_id=?";
jdbcTemplate.update(qry,book.getBook_name(),book.getBook_author(),book.getBook_id());
No comments:
Post a Comment