cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Armstrong <>
Subject Query against flattened relationship w/attribute
Date Thu, 22 Oct 2009 12:57:07 GMT
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

View raw message