Commit 8b0d09a6 by Patryk Czarnik

ładne nazwy klas

parent 19267c32
......@@ -18,10 +18,14 @@ public class Odczyt08_Tablica {
em = emf.createEntityManager();
TypedQuery<Object[]> query = em.createQuery("SELECT e.firstName, e.lastName, e.job.jobTitle, e.salary, e.department.departmentName, e.department.location.city FROM Employee e", Object[].class);
List<Object[]> emps = query.getResultList();
for (Object[] emp : emps) {
List<Object[]> rows = query.getResultList();
for (Object[] emp : rows) {
System.out.println(Arrays.toString(emp));
}
System.out.println("\nSprawdzę typy kolumn:");
Object[] row = (Object[])rows.get(0);
System.out.println(row[0].getClass().getSimpleName() + " " + row[2].getClass().getSimpleName() + " " + row[3].getClass().getSimpleName());
} finally {
if(em != null) em.close();
if(emf != null) emf.close();
......
......@@ -34,7 +34,7 @@ public class Odczyt13_Native {
// Biorę pierwszy wiersz i (informacyjnie, dla nas podczas nauki) sprawdzam typy kolumn. Zauważmy, że kolumna salary jest mapowana na BigDecimal.
System.out.println("Sprawdzę typy kolumn:");
Object[] row = (Object[])rows.get(0);
System.out.println(row[0].getClass() + " " + row[1].getClass() + " " + row[2].getClass());
System.out.println(row[0].getClass().getSimpleName() + " " + row[1].getClass().getSimpleName() + " " + row[2].getClass().getSimpleName());
} finally {
if(em != null) em.close();
if(emf != null) emf.close();
......
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