[jboss-user] [EJB 3.0] - EJBQL : inherintace problem.
do-not-reply at jboss.com
Tue Jun 24 05:11:42 EDT 2008
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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160149#4160149
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160149
More information about the jboss-user