Advertisement
andersonalmada

Untitled

Jul 8th, 2022
1,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. package mandacaru3;
  2.  
  3. import jakarta.persistence.EntityManagerFactory;
  4. import jakarta.persistence.Persistence;
  5. import mandacaru3.entities.Product;
  6.  
  7. public class Main {
  8.  
  9.     public static void main(String[] args) {
  10.         /*
  11.          * ProductDAO productDAO = new ProductJDBCDAO();
  12.          *
  13.          * Product product = new Product(0, "notebook", 2000.4);
  14.          *
  15.          * // Add productDAO.save(product);
  16.          *
  17.          * // Find Product auxProduct = productDAO.find(3);
  18.          * System.out.println(auxProduct);
  19.          *
  20.          * // Find by Name Product auxProduct2 = productDAO.findByName("caderno");
  21.          * System.out.println(auxProduct2);
  22.          *
  23.          * // Find All List<Product> list = productDAO.findAll();
  24.          * System.out.println(list);
  25.          *
  26.          * // Find All by Name list = productDAO.findAllByName("notebook");
  27.          * System.out.println(list);
  28.          *
  29.          * // Update Product auxProduct3 = productDAO.find(5);
  30.          * auxProduct3.setName("televisao"); auxProduct3.setPrice(400.5);
  31.          * productDAO.save(auxProduct3); System.out.println(auxProduct3);
  32.          *
  33.          * // Delete //productDAO.delete(4);
  34.          *
  35.          */
  36.  
  37.         Product product = new Product(0, "notebook", 2000.4);
  38.  
  39.         EntityManagerFactory sessionFactory = Persistence.createEntityManagerFactory("mandacaru");
  40.  
  41.         sessionFactory.close();
  42.  
  43.     }
  44.  
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement