Re: Tutorial Mapping Query

From: Aristedes Maniatis (ar..aniatis.org)
Date: Fri Oct 26 2007 - 19:40:59 EDT

  • Next message: Mikaël Cluseau: "Re: Tutorial Mapping Query"

    On 27/10/2007, at 8:53 AM, Mikaël Cluseau wrote:

    > Its a lot of cut-and-paste, compared to the comment "we need to run
    > the
    > same query three times with different sets of parameters". Wouldn't
    > the
    > best code for this statement be :
    >
    > QueryChain chain = new QueryChain();
    >
    > for (String tableName : new String[] {
    > "PAINTING", "ARTIST", "GALLERY"}) {
    > chain.addQuery(new NamedQuery("DeleteAll",
    > Collections.singletonMap(
    > "table", tableName)));
    > }

    Hi Mikaël

    At the moment, Cayenne 3 still supports JDK1.4 but the above code is
    Java 5 specific. Cayenne 1 and 2 will always continue to support Java
    1.4. Also, the main point of the tutorial is not to demonstrate Java
    coding style choices, but to focus on the Cayenne commands that are
    important. Someone else might create a list of NamedQueries to
    iterate through and someone else might have a map of tablenames
    generated elsewhere.

    As for the original poster, it sounds like you haven't got Cayenne on
    your classpath.

    Ari Maniatis

    -------------------------->
    Aristedes Maniatis
    phone +61 2 9660 9700
    PGP fingerprint 08 57 20 4B 80 69 59 E2 A9 BF 2D 48 C2 20 0C C8



    This archive was generated by hypermail 2.0.0 : Fri Oct 26 2007 - 19:41:37 EDT