Commit 3a49d5c3 by Patryk Czarnik

Jakieś dopiski

parent 44dc5a66
......@@ -27,10 +27,12 @@ public interface Repository5 extends JpaRepository<Employee, Integer> {
List<Employee> findBySalary(BigDecimal min, BigDecimal max);
@Query(nativeQuery=true,
value="SELECT first_name || ' ' || last_name"
+ " FROM employees"
+ " WHERE extract(year FROM hire_date) = :year"
+ " ORDER BY last_name")
value="""
SELECT first_name || ' ' || last_name
FROM employees
WHERE extract(year FROM hire_date) = :year
ORDER BY last_name
""")
List<String> namesByYear(int year);
// W ramach takiego interfejsu można też pisać metody z własną implementacją.
......
......@@ -17,7 +17,7 @@ public class Inject3 {
// Zauważmy, że ta klasa nie jest już poprawnym "JavaBean", bo nie posiada konstruktora domyślnego.
// Adnotacja Autowired tym razem nie jest potrzebna.
public Inject3(Komponent komponent, Repo repo) {
System.out.println("KONSTRUKTOR Inject3(komponent, repo)");
System.out.println("KONSTRUKTOR Inject3(komponent, repo); komponent = " + komponent);
this.komponent = komponent;
this.repo = repo;
}
......
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