From 683e768bf7cfeeb53eaf459caea01be802341e3d Mon Sep 17 00:00:00 2001 From: Jan Vales Date: Wed, 28 Mar 2018 01:06:17 +0200 Subject: [PATCH] [1.2.1c] another dreadful named query. --- ass1-jpa/src/main/java/dst/ass1/jpa/model/impl/Lecturer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ass1-jpa/src/main/java/dst/ass1/jpa/model/impl/Lecturer.java b/ass1-jpa/src/main/java/dst/ass1/jpa/model/impl/Lecturer.java index 5029598..8f5024e 100644 --- a/ass1-jpa/src/main/java/dst/ass1/jpa/model/impl/Lecturer.java +++ b/ass1-jpa/src/main/java/dst/ass1/jpa/model/impl/Lecturer.java @@ -12,6 +12,11 @@ import java.util.Collection; @Entity @Table(name = Constants.T_LECTURER) @PrimaryKeyJoinColumn(name = "id") +@NamedQuery(name = Constants.Q_MOST_ACTIVE_LECTURER, query = "SELECT l" + + " FROM " + Constants.T_LECTURER + " l" + + " WHERE size(l.lessons) >= ALL(" + + " SELECT size(le.lessons) FROM " + Constants.T_LECTURER + " as le GROUP BY le" + + " )") public class Lecturer extends Person implements ILecturer { @OneToMany(targetEntity = Course.class) private Collection courses = new ArrayList<>(); -- 2.43.0