aspose file tools*
The moose likes Other Java Products and Servers and the fly likes XDoclet, JBossQL and EJB QL: Joining multiple tables (2+) possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "XDoclet, JBossQL and EJB QL: Joining multiple tables (2+) possible?" Watch "XDoclet, JBossQL and EJB QL: Joining multiple tables (2+) possible?" New topic
Author

XDoclet, JBossQL and EJB QL: Joining multiple tables (2+) possible?

Karl Beowulph
Ranch Hand

Joined: May 31, 2004
Posts: 130
Howdy.

I'm trying to figure out how I can join multiple tables together in EJB QL using XDoclet.

Suppose for the moment I have three tables. School, Car and Person.

In my PersonEntityBean I've got the following method:



But that simply gets me all the schools that that any particular person belongs to.

What I want is a way to retrieve all the people who are in a certain school and drive a particular car.

The SQL would be (approximately)



Note that School and Car have no relation to each other at all, asides from simply sharing the non-key personID field.

Is what I'm trying to do possible with CMP EJB QL or JBossQL?
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
If you have the following relationships defined

schools.persons //school 1 -> (many) person
person.cars // person 1 -> (many) car

then you should be able to define this method in the SchoolBean




Please check
@ejb-finder tag to embed this query.
Arlet Contreras
Greenhorn

Joined: Dec 01, 2004
Posts: 1
Hi, The answer is very good from my point of view, it helped me a lot, thank you.
And what do you put inside the tag * @jboss:table-name table-name="table" ?
And which are the methods that the CMP includes (get and set)? which table they belong?

cheers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XDoclet, JBossQL and EJB QL: Joining multiple tables (2+) possible?