2 Replies Latest reply on Apr 26, 2006 11:50 AM by Vilmundur Pálmason

    Filling nested collections with specific values

    klaro78 Newbie


      i have a problem with an EJB-QL Query.
      I have following entities, which are nested in collections

      public class Project{
       List<Task> tasks;

      public class Task {
       Project project;
       List<SubTask> subTasks;

      public class SubTask {
       Task task;
       User user;

      public class User {
       String login;

      I want to retrieve all Projects in which a user is involved.
      Additional the Collections should only include the Tasks which includes the SubTasks assigned to this user.

      I have tried the following Query but the Project which was found includes all Tasks in the List.

      select p from Project as p
      inner join p.tasks as t
      inner join t.subTasks as s
      inner join s.user as u
      where u.login = :username

      Any ideas?