db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Marc Lavoie <jeanmarc.lav...@videotron.ca>
Subject Re: I hate IdGenerator
Date Mon, 23 Dec 2002 14:45:05 GMT
If I understand you want to use autoincrement from the database.

Try the following tags :

For the schema itself:

For the Table :

For the primary Key Column :

Using defaultIdMethod="native" on the schema, and nothing on the table 
works greats if you only have autoincrmenet tables.

EPugh@upstate.com wrote:

>Not sure why you are getting those errors(but I think native is bad or
>something), here is my config:
><database name="default" package="com.upstate.kinaseprofiler.torque.db.om"
>defaultIdMethod="native" baseClass="BaseObject" basePeer="BasePeer"
>    <table name="AUDIT" javaName="Audit" idMethod="none">
>      <column name="AUDIT_ID" javaName="AuditId" primaryKey="true"
>required="true" type="INTEGER" />
>      <column name="NAME" javaName="Name" required="true" type="VARCHAR" />
>      <column name="DESCRIPTION" javaName="Description" required="true"
>type="VARCHAR" />
>      <column name="OBJECT_NAME" javaName="ObjectName" required="false"
>type="VARCHAR" />
>      <column name="OBJECT_ID" javaName="ObjectId" required="false"
>type="VARCHAR" />
>      <column name="OBJECT_TYPE" javaName="ObjectType" required="false"
>type="VARCHAR" />
>      <column name="AUDIT_DTIME" primaryKey="false" required="true"
>      <column name="USERNAME" javaName="Username" required="false"
>type="VARCHAR" />
>    </table>
>Eric Pugh
>-----Original Message-----
>From: Tuncay Baskan (Internet Grubu)
>Sent: Saturday, December 21, 2002 10:52 AM
>To: Turbine-Torque-User (E-mail)
>Subject: I hate IdGenerator
>Torque works without a problem when used from a non-webapplication. I'm able
>to save() my objects which have autoIncrement primary keys.
>But when using Torque in a web application I'm getting
>	"IdGenerator for table xxx is null"
>for every table which has an autoincrement primary key.
>For example; in a struts action I have the following:
>	Department dept = new Department();
>	dept.setName("test");
>	dept.save();
>and in a command line application written for testing I have exactly the
>same code but it is working without a problem.
>I think there is only one difference between them. The command line
>version initiates its own connection pooling and gets the connection
>from that pool. The web application which uses Tomcat as server 
>initiates Torque from a servlet with Tomcat's JNDI resource mechanism.
>Is this a configuration problem? If so how can I correct the problem.
>Btw here is the relevant portions of my schema:
><?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
><!DOCTYPE database SYSTEM 
>          "http://jakarta.apache.org/turbine/dtd/database.dtd"><database
>name="eproject" defaultIdMethod="native">
><table name="department" idMethod="native">
>	<column name="department_id" required="true" primaryKey="true"
>	<column name="name" required="true" size="50" type="VARCHAR"/>

View raw message