Commit a3af00b0 by Patryk Czarnik

jakieś drobnostki

parent 8b697af5
......@@ -5,8 +5,6 @@ import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.Persistence;
import sklep.model.Product;
import javax.swing.*;
public class P01_JedenProdukt {
public static void main(String[] args) {
System.out.println("Początek programu");
......@@ -15,7 +13,7 @@ public class P01_JedenProdukt {
EntityManager em = emf.createEntityManager();
System.out.println("Mam em: " + em);
Integer id = Integer.valueOf(JOptionPane.showInputDialog("Podaj id produktu"));
Integer id = 1;
Product product = em.find(Product.class, id);
// w razie braku takiego rekordu, wynikiem jest null
if(product == null) {
......
......@@ -32,7 +32,7 @@ public class P03_OdczytajZamowienie {
}
// Mając wczytany jeden obiekt, możemy za pomocą gettera odczytać obiekt z innej tabeli, który jest powiązany z bieżącym
Customer customer = order.getCustomer();
System.out.println("Odczytany obiekt klienta: " + customer);
System.out.println("Odczytany obiekt klienta: " + customer + " klasy " + customer.getClass());
System.out.println(customer.getCustomerEmail() + " " + customer.getCustomerName());
System.out.println("Produkty:");
for (OrderProduct op : order.getOrderProducts()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment