Hi everybody,

If I made an unidirectional n:m relationship between, letÂs say, a CustomerBean and a 
AddressBean bean (customer has a getter and a setter for his addresses). The mapping 
is made by a relational table. Both beans work. And after that I want to implement an 
ejbSelectStreets method (without parameters) to get all streets of a certain customer. 
What should the ejbQuery look like?

I tried this:

public abstract Collection ejbSelectStreets () throws FinderException;

EJB-QL for this:

SELECT address.street FROM CustomerAPS AS customer, IN (customer.addresses) as address

But when I call the ejbSelect-Method in a customer bean, I simply get ALL street 
entries in the database, not exactly the streets of THIS customer.

Is it impossible to read the streets without giving the primary key to the selecter? 
This here works, but seems too complicated to me...

public abstract Collection ejbSelectStreets (Integer pk) throws FinderException;

EJB-QL for this:

SELECT address.street FROM CustomerAPS AS customer, IN (customer.addresses) AS address 
WHERE customer.id = ?1

Thanks for your help in advance!
Oliver


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3830932#3830932

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3830932


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to