Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mandacaru3;
- import java.util.List;
- import mandacaru3.dao.ProductDAO;
- import mandacaru3.dao.ProductJDBCDAO;
- import mandacaru3.entities.Product;
- public class Main {
- public static void main(String[] args) {
- ProductDAO productDAO = new ProductJDBCDAO();
- Product product = new Product(0, "notebook", 2000.4);
- // Add
- productDAO.save(product);
- // Find
- Product auxProduct = productDAO.find(3);
- System.out.println(auxProduct);
- // Find by Name
- Product auxProduct2 = productDAO.findByName("caderno");
- System.out.println(auxProduct2);
- // Find All
- List<Product> list = productDAO.findAll();
- System.out.println(list);
- // Update
- Product auxProduct3 = productDAO.find(5);
- auxProduct3.setName("televisao");
- auxProduct3.setPrice(400.5);
- productDAO.save(auxProduct3);
- System.out.println(auxProduct3);
- // Delete
- //productDAO.delete(4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement