> -----Original Message-----
> From: Charlene Mitchell [mailto:charlene_ml@;yahoo.co.uk]
>
> You are indeed right, an Address might not need a back
> link to an Employee - but it also might (e.g. if I
> wanted to find all Employees that lived in a certain
> town).

Value objects are not intended to do this.  If you wanted to perform a query
like the one you mentioned, you would create a custom finder for the
Employee bean:

/**
 * ...
 *
 * @ejb.finder view-type="remote"
 *             signature="java.util.Collection
findEmployeesByCity(java.lang.String city)"
 *             result-type="Remote"
 *             query="select object(employee) from Employee as employee
where employee.address.city=?1"
 */

You could then execute this method on EmployeHome and get back a Collection
of employees in that city.  You could then ask those Employee objects for
their light/normal values.

> My application could have 4 related entities. I have a
> requirement to get all Addresses and MobileTelephone
> numbers for all Employees that work in a certain
> Department!!!

Again, you would create a similar custom finder:

/**
 * ...
 *
 * @ejb.finder view-type="remote"
 *             signature="java.util.Collection
findEmployeesByDepartment(java.lang.Integer departmentId)"
 *             result-type="Remote"
 *             query="select object(employee) from Employee as employee
where employee.department.id=?1"
 */

Michael


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to