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

[EMAIL PROTECTED]@
[EMAIL PROTECTED]@.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:[EMAIL PROTECTED]
Sent: Monday, February 09, 2004 11:23 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to