db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Zverina <da...@zverina.co.uk>
Subject negative primary keys
Date Fri, 23 Apr 2004 09:54:32 GMT
It seems that torques has a problem with the auto-generated code for
foreign-keys if the key is negative. Looking at the generated code the
reason seems obvious. Is there any reason why the check of "this.stageId
> 0" exists? Removing it seems to cause no ill effect in my code except
that it will now work correctly with negative (non-zero keys). 

Any ideas,

David Zverina.

    public Stage getStage() throws TorqueException
        if (aStage == null && (this.stageId > 0))
                          aStage =
            /* The following can be used instead of the line above to
               guarantee the related object contains a reference
               to this object, but this level of coupling
               may be undesirable in many circumstances.
               As it can lead to a db query with many results that may
               never be used.
               Stage obj = StagePeer.retrieveByPK(this.stageId);
        return aStage;

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

View raw message