Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 53593 invoked from network); 9 Feb 2004 19:15:15 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 9 Feb 2004 19:15:15 -0000 Received: (qmail 51827 invoked by uid 500); 9 Feb 2004 19:15:05 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 51801 invoked by uid 500); 9 Feb 2004 19:15:04 -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 51760 invoked from network); 9 Feb 2004 19:15:04 -0000 Received: from unknown (HELO mailhub.stusta.mhn.de) (141.84.69.5) by daedalus.apache.org with SMTP; 9 Feb 2004 19:15:04 -0000 Received: (qmail 18133 invoked from network); 9 Feb 2004 19:15:07 -0000 Received: from r095096.stusta.swh.mhn.de (HELO in.tum.de) (10.150.95.96) by mailhub.stusta.mhn.de with SMTP; 9 Feb 2004 19:15:07 -0000 Message-ID: <4027DC30.6020704@in.tum.de> Date: Mon, 09 Feb 2004 20:14:56 +0100 From: Sheng Guo User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Apache Torque Developers List Subject: Re: Problem with Insert records to the database References: <794AA7B1BE0DB2458F738486D7353943BF552B@mail.funnygarbage.com> In-Reply-To: <794AA7B1BE0DB2458F738486D7353943BF552B@mail.funnygarbage.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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 Hi, I checked it again in the Torque.template file, and I really configured it to postgresql. (see below) And I have the same value for torque.database.XXX.adapter=postgresql in the Torque.properties file. # ------------------------------------------------------------------- # # T O R Q U E P R O P E R T I E S # # ------------------------------------------------------------------- # These are your database settings. Look in the # org.apache.torque.pool.* packages for more information. # # The parameters to connect to the default database. You MUST # configure these properly. # ------------------------------------------------------------------- torque.database.default=@DATABASE_DEFAULT@ torque.database.@DATABASE_DEFAULT@.adapter=postgresql Russell Simpkins wrote: >That error would seem to suggest that your Torque is configured to use Oracle and not postgresql. Postgresql uses curval('name') and nextval('name'); > >I may be wrong, but you should double check your configuration. > > > > > >-----Original Message----- >From: Sheng Guo [mailto:sheng@in.tum.de] >Sent: Monday, February 09, 2004 11:23 AM >To: torque-dev@db.apache.org >Subject: Problem with Insert records to the database > > >Hello, > >I am doing a web application project with Turbine2.3+Velocity+Torque. As >a database I have PostgreSQL 7.2. As I tried to insert the data, which >I collected from the web page, there was alway an exception: > >org.apache.torque.TorqueException: ERROR: cnt_test_seq.currval is not >yet defined in this session > >the cnt_test_seq was already defined in the database, but I don't have >the "currval" anywhere in the database. How can that happen? > >I followed the tutorial on the Torque site to write the code, but it >didn't work. I had the following code in my Java file: > >//name of the method, which did the insert >public void doSavedata(RunData data, Context context) { > > //collect data from the Velocity template > String name = data.getParameters().getString("name"); > String beschreibung = data.getParameters().getString("beschreibung"); > String identifikator = data.getParameters().getString("identifikator"); > String gueltigkeit = data.getParameters().getString("gueltigkeit"); > > CNTTest ct = new CNTTest(); //The om class, which was generated by >Torque > > //set the attributes of the instance of CNTTest > Integer id = new Integer(2); > ct.setId(id); > ct.setName(name); > ct.setDescription(beschreibung); > ct.setAttributeType(identifikator); > Integer g = new Integer(5); > ct.setSortOrder(g); > > //save in to the database. > try { > ct.save(); > System.out.println("save ok"); > context.put("status", "sucess"); > System.out.println("context--sucess"); > } > catch (Exception ex) { > String message = ex.toString(); > System.out.println(message); > ex.printStackTrace(); > context.put("status", "failed"); > context.put("message", message); > System.out.println("context--failed"); > } > >I am looking forward to hearing from your earliest reply! > >yours sincerely > >Guo > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org >For additional commands, e-mail: torque-dev-help@db.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org >For additional commands, e-mail: torque-dev-help@db.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org