-
1. Re: Inheritence and EJBQL
tynor Sep 27, 2007 3:53 PM (in response to tynor)I don't want to be a pest, but could someone at least tell me if what I'm trying to do should work (hence I should try harder to understand what I've misconfigured), or if I should just give up and use my work around (separate queries for each subclass)?
I'm using JBoss AS 4.2.1.GA and Seam 2.0.0.CR1
ThanksCan EJBQL be used to query polymorphically? I cannot find any examples in the spec or in Bill Burke's EJB3 book, and my attempts are always returning null.
Code:
l = entityManager.createQuery("SELECT s FROM Security s").getResultList();
Here I'm trying to find all rows of all security subclasses. Even though the database has many such entries, the query always returns null. I can find each subclass independently - eg.:
-
2. Re: Inheritence and EJBQL
wolfgangknauf Sep 28, 2007 5:55 AM (in response to tynor)Hi !
this should work. I have done the same by declaring named queries on each of the bean classes.
you could take a look at this sample:
http://www.informatik.fh-wiesbaden.de/~knauf/SWTVertiefung2007/kucheninheritance/KuchenInheritance.ear
Unfortunately the language is german, but hope you can make your way through the code.
The application client calls finder methods to load
-all beans of all subtypes
-all beans of subtype a
-all beans of subtype b
Hope his helps
Wolfgang -
3. Re: Inheritence and EJBQL
tynor Sep 28, 2007 9:46 AM (in response to tynor)Thanks Wolfgang, that's very helpful!
I don't see anything obviously different in your code vs. mine, but knowing that this works for you, I'll now start getting serious about finding my error. I'll report back to the thread when I fix it.
Thanks again,
Steve