Commit 8d68eede by Patryk Czarnik

jakieś komentarze

parent 3ce0aa2d
......@@ -16,14 +16,14 @@ public class MiniEmp {
this.lastName = lastName;
this.jobTitle = jobTitle;
this.salary = salary;
System.out.println("salary YES");
//System.out.println("salary YES");
}
public MiniEmp(String firstName, String lastName, String jobTitle) {
this.firstName = firstName;
this.lastName = lastName;
this.jobTitle = jobTitle;
System.out.println("salary NO");
//System.out.println("salary NO");
}
public String getFirstName() {
......
......@@ -47,7 +47,8 @@ public class Employee extends WspolnaNadklasa implements Serializable {
private Department department;
//uni-directional many-to-one association to Employee
@ManyToOne
// obiekt manager nie jest od razu wczytywany, tylko gdyby ktoś bezpośrednio pobrał za pomocą getManager()
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="manager_id")
private Employee manager;
......
......@@ -18,8 +18,8 @@ public class Criteria1 {
EntityManager em = emf.createEntityManager();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
Root<Employee> root = cq.from(Employee.class);
CriteriaQuery<Employee> cq = cb.createQuery(Employee.class); // typ wyniku
Root<Employee> root = cq.from(Employee.class); // tabela źródłowa
cq.select(root);
TypedQuery<Employee> query = em.createQuery(cq);
......
......@@ -40,6 +40,7 @@ public class Odczyt06_Warunek {
System.out.println("Ilość rekordów " + lista.size());
for (Employee employee : lista) {
System.out.println(employee.getFirstName() + " " + employee.getLastName());
//System.out.println(employee.getJob());
}
} finally {
......
......@@ -23,6 +23,7 @@ public class Odczyt14_Native {
job_title AS "jobTitle",
salary AS "salary",
round(avg(salary) OVER (PARTITION BY department_id), 2) AS "depAvg",
round(salary - avg(salary) OVER (PARTITION BY department_id), 2) AS "diff",
rank() OVER (PARTITION BY department_id ORDER BY salary DESC) AS "depPos",
rank() OVER (ORDER BY salary DESC) AS "globalPos"
FROM departments d
......
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