You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Borut Bolčina <bo...@najdi.si> on 2006/07/07 06:52:50 UTC
oid as PK
Hello,
in my model I have a table with attribute oid marked as Primary Key. I
use AUTO_PK_SUPPORT table for PK generation. This table holds say
100.000 records. In my business case I have to go over each of them and
this process lasts even three days sometimes (a lot of work for each
record - that is why). If this process is interrupted, I remember which
record was last processed, so I can continue working from there on in
the next run.
I broke the app when I introduced oid as class propery which I did for
the following reason:
qual = qual.andExp(ExpressionFactory.greaterExp("oid", lastIndexedSource));
I broke it becouse the code for inserting now no longer works as oid is
a required property. dataContext.commitChanges raises
ValidationException. I would have to set oid within my code which I
don't want to do, I have AUTO_PK_SUPPORT to do that.
Is there an equivalent way to construct a qualifier for the expression
which would return records with primary keys (oids) greater than some value?
Thanks,
Borut
Re: oid as PK
Posted by Borut Bolčina <bo...@najdi.si>.
Thanks Andrus!
Andrus Adamchik pravi:
>
> On Jul 7, 2006, at 12:52 AM, Borut Bolčina wrote:
>
>> qual = qual.andExp(ExpressionFactory.greaterExp("oid",
>> lastIndexedSource));
>
>
> Actually you can use an expression with "db:" prefix to match on a
> table column that is not an object property. ExpressionFactory doesn't
> have a "db" flavor for some of its methods, including 'greaterExp' (an
> oversight on our part), but you can use Expression.fromString(..)
>
> qual = qual.andExp(Expression.fromString("db:oid > " +
> lastIndexedSource));
>
> Andrus
Re: oid as PK
Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jul 7, 2006, at 12:52 AM, Borut Bolčina wrote:
> qual = qual.andExp(ExpressionFactory.greaterExp("oid",
> lastIndexedSource));
Actually you can use an expression with "db:" prefix to match on a
table column that is not an object property. ExpressionFactory
doesn't have a "db" flavor for some of its methods, including
'greaterExp' (an oversight on our part), but you can use
Expression.fromString(..)
qual = qual.andExp(Expression.fromString("db:oid > " +
lastIndexedSource));
Andrus