3 Replies Latest reply on Jan 29, 2003 4:28 AM by Christoph Henrici

    EJB QL Error?

    Christoph Henrici Newbie

      Given a EJB A, which build a composite recursive datastructure, something like:

      setId(Long id) // The unique identifier of A
      getId() : Long

      setParent(A)
      getParent() : A

      setChildren(Collection ofAs)
      getChildren() : Collection

      I want to query now all A's, which do not have a parent:

      SELECT OBJECT(a) FROM A a WHERE a.parent IS NULL

      Executing this EJB-QL i always get an empty collection.

      The SQL, which is generated is something like:

      SELECT t0_a.id FROM ELEMENTTYPENODE t0_a WHERE (t0_a.parent IS NULL) AND (t0_a.parent=t0_e.id)

      which is naturally wrong in this case.

      Is this a bug or a restriction?
      Is there any workaround?

      Best thanx for any help
      Christoph Henrici