Return-Path: Mailing-List: contact turbine-torque-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list turbine-torque-user@jakarta.apache.org Received: (qmail 14349 invoked by uid 98); 6 Dec 2002 16:43:49 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Received: (qmail 14330 invoked from network); 6 Dec 2002 16:43:47 -0000 Received: from daedalus.apache.org (HELO apache.org) (63.251.56.142) by nagoya.betaversion.org with SMTP; 6 Dec 2002 16:43:47 -0000 Received: (qmail 7121 invoked by uid 500); 6 Dec 2002 16:42:39 -0000 Received: (qmail 7114 invoked from network); 6 Dec 2002 16:42:39 -0000 Received: from qodns00.genelogic.com (149.2.141.40) by daedalus.apache.org with SMTP; 6 Dec 2002 16:42:39 -0000 Received: from qolotus00.genelogic.com (qolotus00 [10.1.1.21]) by qodns00.genelogic.com (8.11.0/8.11.0) with ESMTP id gB6GgJw04697 for ; Fri, 6 Dec 2002 11:42:20 -0500 (EST) Subject: Re: PK-generation problems using Oracle seqs To: "Turbine Torque Users List" X-Mailer: Lotus Notes Release 5.0.10 March 22, 2002 Message-ID: From: JDiggans@genelogic.com Date: Fri, 6 Dec 2002 11:42:30 -0500 X-MIMETrack: Serialize by Router on QOLOTUS00/Genelogic(Release 5.0.10 |March 22, 2002) at 12/06/2002 11:42:32 AM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Looked at MapBuilder.vm I see the below: #if ($table.IdMethod == "native") tMap.setPrimaryKeyMethod(TableMap.NATIVE); #elseif ($table.IdMethod == "autoincrement") tMap.setPrimaryKeyMethod(TableMap.AUTO_INCREMENT); #elseif ($table.IdMethod == "sequence") tMap.setPrimaryKeyMethod(TableMap.SEQUENCE); #elseif ($table.IdMethod == "idbroker") tMap.setPrimaryKeyMethod(TableMap.ID_BROKER); #else tMap.setPrimaryKeyMethod("$table.IdMethod"); #end #if ($table.IdMethodParameters) // this might need upgrading based on what all the databases // need, but for now assume one parameter. #set ($imp = $table.IdMethodParameters.get(0) ) tMap.setPrimaryKeyMethodInfo("$imp.Value"); #elseif ($table.IdMethod == "idbroker") tMap.setPrimaryKeyMethodInfo(tMap.getName()); #elseif ($table.IdMethod == "sequence" || ($table.IdMethod == "native" && $dbprops.get("idMethod") == "sequence")) tMap.setPrimaryKeyMethodInfo("$table.SequenceName"); #elseif ($table.IdMethod == "native" && $dbprops.get("idMethod") == "identity") tMap.setPrimaryKeyMethodInfo("$table.Name"); #end This seems to me that if one's defaultIdMethod is 'native' and one doesn't put in any table idMethod indicators that the setPrimaryKeyMethodInfo will never get run for this table map (which seems to be my problem). Acc. to this logic flow one would have to manually set each table to be 'native' and the database method to be 'sequence' which makes no sense to me at all (not to mention a post in the archives that suggests dbprops isn't in scope in this file on which I cannot comment) ... can someone enlighten me on this program flow in map generation? Many thanks ... -j ------------------------------------------------- James Diggans Bioinformatics Programmer Gene Logic, Inc. Phone: 301.987.1756 FAX: 301.987.1701 JDiggans@genelogi c.com To: "Torque" 12/05/2002 07:57 cc: PM Subject: PK-generation problems using Oracle seqs Please respond to "Turbine Torque Users List" All, I have a method (in turbine) that attempts to write a new object to a torque O/R database (using torque 3.0rc2) and it's having problems w/ primary key generation using 'native' Oracle sequences for the pk keygen (ID_TABLE IDs work fine). Here's the table definition (the defaultIdMethod for the is 'native'):
the method: public void doInsert(RunData data, Context context) throws Exception { CvSpecies entry = new CvSpecies(); data.getParameters().setProperties(entry); entry.setNew(true); entry.save(); } and the error I'm getting: java.lang.reflect.InvocationTargetException ..... Caused by: org.apache.torque.TorqueException: ORA-01400: cannot insert NULL into ("GX_NODEDB10"."CV_SPECIES"."SPECIES_ID") at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:729) at com.genelogic.nodedb.om.BaseCvSpeciesPeer.doInsert(BaseCvSpeciesPeer.java:192) at com.genelogic.nodedb.om.BaseCvSpeciesPeer.doInsert(BaseCvSpeciesPeer.java:475) at com.genelogic.nodedb.om.BaseCvSpecies.save(BaseCvSpecies.java:779) at com.genelogic.nodedb.om.BaseCvSpecies.save(BaseCvSpecies.java:741) at com.genelogic.nodedb.om.BaseCvSpecies.save(BaseCvSpecies.java:721) at com.genelogic.nodedb.modules.actions.admin.species.SpeciesFormActions.doInsert(SpeciesFormActions.java:45) ... 48 more It looks to me like the primary key, for some reason, is not getting generated. I have no idea why, the sequence is in the database and has not yet been touched so whatever method the BasePeer class is supposed to run to get the new ID doesn't seem to be happening. This is my first attempt using native sequences w/ torque ... anyone have any suggestions? My thanks ... -j ------------------------------------------------- James Diggans Bioinformatics Programmer Gene Logic, Inc. Phone: 301.987.1756 FAX: 301.987.1701 -- To unsubscribe, e-mail: < mailto:turbine-torque-user-unsubscribe@jakarta.apache.org> For additional commands, e-mail: < mailto:turbine-torque-user-help@jakarta.apache.org>