Hi, I have a question about using reference fields in a template object for QueryByCriteria.
I have three persistent classes: Country, Language and Locale. The Locale class has a reference to a Country instance and a reference to a Language instance, using anonymous fields as the foreign keys. I want to construct a Locale and create a template to use with QueryByCriteria in order to get all locales that have a certain country or language. For example: Country country; // get reference to Country object using PB Locale template = new Locale(); template.setCountry(country); QueryByCriteria query = new QueryByCriteria(template); Collection results = broker.getCollectionByQuery(query); This doesn't work, and the returned collection contains all locales, not just those for the given country. I realize that this is because the anonymous country foreign key field in the template object is not set. If I use the following code before creating the query, I get the results that I want: BrokerHelper helper = broker.serviceBrokerHelper(); helper.link(template, false); I was wondering if there is a setting in the mapping descriptor, or elsewhere in OJB that automates this link operation? Regards, Sam --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
