0 Replies Latest reply on Jun 24, 2008 5:11 AM by Jan Peti

    EJBQL : inherintace problem.

    Jan Peti Newbie

      the problem: jpql query
      I have 7 classes:

      @Inheritance(strategy = InheritanceType.JOINED)
      @DiscriminatorColumn(name = "person_typ", discriminatorType = DiscriminatorType.STRING, length = 1)
      public class Person

      2. JuristischePerson(JP) extends Person - @DiscriminatorValue("J")
      3. Naturliche(NP) extends Person - @DiscriminatorValue("N")
      4. Verein(V) extends Person - @DiscriminatorValue("V")
      by these 4 classes

      5. VerNehmer 1to1 relation to Person
      6. Halter 1to1 relation to Person

      7. The Main class:
      Evb 1to1 relation to VerNehmer
      1to1 relation to Halter

      I am using now a query to retrieve all evbs:
      select e from Evb e left join e.halter h left join h.person p

      1.I need the left joins because halter is sometimes null and also person in halter is sometimes null.
      2.Person has general properties. More specific are juristische person with its name and so on...

      Example for a problem:
      JurisischePerson has a name property. Person does not.
      I need to retrieve all evbs which the person of halter is FOR example a juristische person and has a name "Bank*" but also it can be another type like naturliche person which name could also be "Bank*"

      In a query you can see the halter has only a person not JP, or NP,...
      I would need something like this to ONLY ilustrate(I know that this is errorous):

      select e from Evb e left join e.halter h left join h.person p as JuristischePerson jp, as NaturlischePerson np, as Verein v where jp.jurName like 'Bank%' or np.natName like 'Bank%' or v.verName like 'Bank%'.

      I need to have an alias for different types of person(s)- people to have the possibility to check if the name is what I am looking for.