1 Reply Latest reply on Oct 28, 2005 2:31 AM by evrim

    EJB Query Question

    jagthedrummer

      Hello all! I've been playing with the latest EJB3 stuff and I really like it. It's much better than the EJB2 way of doing things.

      I'm pretty new to writing EJB queries, and I'm having trouble finding an example of what I need to do. I hope someone can point me in the right direction.

      Basically I have a Person entity with a collection of Persons as an attribute called children. Something like this:

      public class Person{
       private String firstName;
       private Collection<Person> children;
      }
      


      I have everything working as far an insert/delete and the persistence of the collection goes, but I'd like to be able to write a query that will return a list of all Persons who have a child with firstName='John' for example. I think this should be easy to do, I'm just not quite there with my EJB QL skills yet.

      Thanks in advance, and keep up the good work.

      Jeremy