Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mandacaru3;
- import jakarta.persistence.EntityManagerFactory;
- import jakarta.persistence.Persistence;
- 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);
- *
- * // Find All by Name list = productDAO.findAllByName("notebook");
- * 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);
- *
- */
- Product product = new Product(0, "notebook", 2000.4);
- EntityManagerFactory sessionFactory = Persistence.createEntityManagerFactory("mandacaru");
- sessionFactory.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement