tags:

views:

242

answers:

1

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.

+1  A: 

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)
Superfilin
awesome. Thank you.
KevMo