From torque-dev-return-4131-apmail-db-torque-dev-archive=db.apache.org@db.apache.org Fri Apr 23 09:57:08 2004 Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 70542 invoked from network); 23 Apr 2004 09:57:08 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 23 Apr 2004 09:57:08 -0000 Received: (qmail 87628 invoked by uid 500); 23 Apr 2004 09:56:41 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 87545 invoked by uid 500); 23 Apr 2004 09:56:40 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 81126 invoked from network); 23 Apr 2004 09:54:28 -0000 Subject: negative primary keys From: David Zverina To: torque-dev@db.apache.org Content-Type: text/plain Message-Id: <1082714071.1566.25.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Fri, 23 Apr 2004 10:54:32 +0100 Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 = StagePeer.retrieveByPK(SimpleKey.keyFor(this.stageId)); /* 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); obj.addItems(this); */ } return aStage; } --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org