db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: saving the state of a object collection
Date Fri, 28 Mar 2008 17:15:48 GMT
"Greg Monroe" <Greg.Monroe@DukeCE.com> schrieb am 28.03.2008 17:54:31:

> Only things that come to mind quickly are:
>
> Use a custom Criteria to build a NOT IN clause that with
> an expression to combine your keys.  E.g. build the
> following sort of Custom criteria:
>
> CONCAT(CAST(Book.ID1 AS CHAR),'-',CAST(Book.ID2 AS CHAR))
> NOT IN ( '1-1', '2-1',...)

Good point. But only works correctly under all circumstances when keys are
integers. When keys are random strings, one would have to do escaping,
which is even more painfull than criteria juggling.

>
> Alternatively, you could just add a unique non-key record id
> to book table.  It doesn't have to be the key, just an
> auto increment field.  Then you could just use a normal
> NOT IN criteria.

This will always work, you are right. Basically, you are saying "Not using
composite keys will make life easier". Hm, I should have taken this advice
when designing the db schema....

   Thanks,

        Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message