Query-Question

From: Michael Schuldt (m..scensys.de)
Date: Tue Jan 28 2003 - 13:09:23 EST

  • Next message: Andrus Adamchik: "Re: Query-Question"

    Hi,

    following situation:

    I've got several artists and each artists has several paintings. There is a
    1:n relationship from artist to painting. Just like in the cayenne-example.

    Now I want to get a special artist and for this artist only those paintings,
    where the status is off.

    I tried this by using the following code:

    ...
    Expression qual = ExpressionFactory.binaryPathExp (Expression.EQUAL_TO,
                                                       "artistName",
                                                       strArtistNameName);

    qual = qual.andExp (ExpressionFactory.binaryPathExp(Expression.EQUAL_TO,
                                                        "hasPaintings.status",
                                                        "off"));
    ...

    After executing the query I'm getting a List of Artists (in this case only
    one!). Using this one artist I'd like to get the paintings with the status
    'off'. By iterating through the list got from getHasPaintings I see all
    paintings belonging to this artist. The status was ignored.

    I used the generated sql-query in MySql-Front and voila: I'm getting only
    those paintings with the status 'off'. But within cayenne the status will be
    ignored!

    Any help or suggestions?

    Michael



    This archive was generated by hypermail 2.0.0 : Tue Jan 28 2003 - 13:08:22 EST