Hi Tore,
"addCustomDbAttribute" was one of those early things in Cayenne a few
years back when the strategy was "just make it work", so there is a
room for improvement. Your description of its behavior is correct - it
can't use a "path", only a root entity attribute, and once you have at
least one custom attribute, all the "standard" ones are not used, so
you have to set all needed columns.
So I guess it does require some rework now...
Andrus
On Oct 30, 2004, at 9:02 PM, Tore Halset wrote:
> Hello.
>
> The javadoc for SelectQuery.addCustomDbAttribute(String) says "Adds a
> path to the DbAttribute that should be included in the results of this
> query. Valid paths would look like ARTIST_NAME,
> PAINTING_ARRAY.PAINTING_ID, etc"
>
> Q1: I have not managed to get addCustomDbAttribute to work with
> arguments ala PAINTING_ARRAY.PAINTING_ID. Is it supposed to work? I
> might be doing something wrong..
>
> Q2: I have a SelectQuery that fetches datarows for a given ObjEntity.
> If I try to add a single addCustomDbAttribute only the added attribute
> are queried for. All the standard attributes of the given ObjEntity
> are not included in the query. Am I doing something wrong here as
> well? Perhaps I should manually do addCustomDbAttribute on all the
> attributes that I want to add.
>
> SelectQuery q = new SelectQuery(Artist.class);
> q.setFetchingDataRows(true);
> q.addCustomDbAttribute("name");
>
> Regards,
> - Tore.
>
>
This archive was generated by hypermail 2.0.0 : Sun Oct 31 2004 - 10:58:22 EST