db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Galil <guy_ga...@guardium.com>
Subject RetrievByPK strange behavior
Date Wed, 21 Feb 2007 20:30:50 GMT
We are using an old version of Torque - Torque 3.0.2 for a long time
now.
We recently encountered a strange behavior of the retrieveByPK method:
we have a column defined as -
<table name="MYTABLE_LOG" description="Log of dropped and rejected
constructs" idMethod="native">
    <column 
      name="MYTABLE_LOG_ID" 
      required="true" 
      primaryKey="true" 
      type="BIGINT" 
      autoIncrement="true"/>


....



The generated sql is -
drop table if exists MYTABLE_LOG;

CREATE TABLE MYTABLE_LOG
(
                    MYTABLE_LOG_ID BIGINT NOT NULL AUTO_INCREMENT,
....

the mysql table is actually created with the column type
 bigint(20)

Id values in the database get to be big.

The problem is when using retrievebypk and the id passed is long. The
method in the base class looks like:
    public static MytableLog retrieveByPK(long pk)
        throws TorqueException
    {
        return retrieveByPK(SimpleKey.keyFor(pk));
    }

looking at the values in a debugger we see:
pk = 22620000000000031
SimpleKey.keyFor(pk) = 22620000000000032
and
return retrieveByPK(SimpleKey.keyFor(pk)) either fails fails (failed to
retrieve one
row...) if the record is not found or returns the wrong record (see it
passes the id + 1)

This problem did not occur when our keys were of type integer.

Any help will be appreciated
Guy


---------------------------------------------------------------------
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