Hi Lindsay,
I am not sure I completely understand your question, still...
Yes, a query result list always consists of objects of the same type
(e.g. Employee). *Related* objects (e.g. Departments or Projects) are
just properties of the query main object. To set up associations
between related objects, use relationships in the modeler. If you used
Modeler to reverse-engineer the DB, on most DBs (except MySQL, where
you need to do it manually) your objects should have the relationships
setup automatically, as they are inferred from FK constraints. So your
Employee class ends up having the following methods:
Department getToDepratment();
void setToDepratment(Department);
List getProjects()
...
Once you have a hold of a given Employee, you can simply call these
methods to get related objects. Cayenne will lazily resolve all needed
objects by performing a DB call when needed.
Does this answer your question?
Andrus
On Aug 30, 2004, at 8:12 PM, Lindsay Steele wrote:
> The tapestry example in the docs is great for showing you how to set up
> a cayenne
> environment in tapestry but as far as I can tell does not cover what I
> am talking about.
>
> -----Original Message-----
> From: shaun [mailto:wojing..astmail.com.au]
> Sent: Tuesday, 31 August 2004 9:56 AM
> To: lsteele; cayenne-use..bjectstyle.org
> Subject: Re: How Cayenne works ??
>
>
> Hi,
>
> I think I saw a tapestry example in the examples directory. regards
> -
> shaun
>
> On Tue, 31 Aug 2004 08:58:59 +1000, "lsteele" <lsteel..inet.net.au>
> said:
>> This is a bit of a newbie question but I have done lots of reading in
>> the docs and cannot really come up with an answer.
>>
>> I am currently converting an early development tapestry app over to
> use
>> cayenne and so far I like what I see. Eventually (after submitting
> it
>> as a uni project) I will open the code so it might be useful for
>> others.
>>
>> I seem to be having trouble visualising how Cayenne brings back a
>> group of objects from a query or how the when it brings back a group
>> of objects linkages are maintained between the objects.
>>
>> The problem I need to pass an object to the am running into is that
> the
>> contrib:Table. I pass a single object and then assign
>> get methods to the coloumns in the table. In SQL I just a create a
>> new object and pass this.
>>
>> What is the best way to do something like this in Cayenne. ??
>>
>> I have used the modeller to set up my objects similarly to the
>> examples that I see in the docs .. but this still only brings back the
>
>> single object.
>>
>> Is there a way to do a query on an object with links to other objects
>> and bring back a collection of single objects that contrains data from
>
>> that query ?
>>
>> Are there any more complex examples for doing things like this ?? Has
>
>> anyone seen examples for doing something like this in Tapestry ??
>>
>> Thanks,
>>
>> Lindsay
>>
>
>
>
>
This archive was generated by hypermail 2.0.0 : Mon Aug 30 2004 - 20:24:15 EDT