Query against flattened relationship w/attribute

From: John Armstrong (siberia..iberian.org)
Date: Thu Oct 22 2009 - 08:57:07 EDT

  • Next message: Emanuele Maiarelli: "Re: cayenne tomcat memory management"

    I have a flattened relationship in Cayenne and my table looks like this :

    +-----------------+---------
    | Field | Type
    +-----------------+-----------
    | CLIENT | int(11) // Foreign key to CLIENT table
    | CLIENTPRINTERID | varchar(1024) // String id assigned outside of
    app to this relationship
    | ID | int(11) // primary key
    | PRINTER | int(11) // Foreign key to PRINTER table

    In this case its a join table that matches an instance of a CLIENT
    with and instance of a PRINTER along with a random ID assigned by
    another process for this relationship.

    I can use this join relationship with the standard relationship list
    accessors (printer.getClients and client.getPrinters, I rename these
    methods for sanity) but what I really need to do is:

    Query this table to retrieve an instance of a PRINTER object based on
    search for a specific CLIENT and the string CLIENTPRINTERID. Is this
    possible without resorting to fromString?

    The idea here is that there may be one printer but 50 clients that have that
    printer installed and point to it, each with its own wonderful ID
    (derived internally
    by the windows print spooler).

    For now I am just forcing the issue by querying against the
    clientprintermap directly but I am thinking there is a more elegant
    way.
    Tx
    John



    This archive was generated by hypermail 2.0.0 : Thu Oct 22 2009 - 08:57:47 EDT