0

I'm attempting to write what should be a simple (I hope) EJB-QL query.

Here are my objects:

public class Room {
     private String name;
     private List<RoomConfiguration> configs;
}

public class RoomConfiguration {
     private Integer capacity;
     private String name;
}

How can I search for rooms with a minimum capacity? A room can have multiple configurations, and each of those configurations has a different capacity.

KevMo
  • 5,590
  • 13
  • 57
  • 70

1 Answers1

1

Something like this:

select room, config 
from Room room 
left outer join room.configs config
where config.capacity = (select min(rc.capacity) from RoomConfiguration rc) 
Andrey Adamovich
  • 20,285
  • 14
  • 94
  • 132