db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tuncay Baskan (Internet Grubu)" <Tuncay.Bas...@intertech.com.tr>
Subject RE: I hate IdGenerator
Date Mon, 23 Dec 2002 07:43:22 GMT
Hi,

I found a solution to the problem and sent it already but mail server
failed. Here it is:

-------------------------------

It was my stupidity. There was another *big* difference between 
applications, (web and and non-web) Torque.properties. I innocently
commented the torque.database.project.adapter configuration line.

Since Tomcat provides the pooling and Torque uses that pool from the
JNDI I thought Torque does not need to know which adapter to use.

I think Torque documentation should mention if adapter is not specified
Torque cannot manage native auto incremented primary keys.

And I think Torque documentation should be much bigger and more 
comprehensive that it is today. I plan to contribute (if approved 
of course) after this project completed.

/tb.

> -----Original Message-----
> From: EPugh@upstate.com [mailto:EPugh@upstate.com]
> Sent: Sunday, December 22, 2002 7:58 PM
> To: turbine-torque-user@jakarta.apache.org
> Subject: RE: I hate IdGenerator
> 
> 
> 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"
> defaultJavaType="object">  
>   
>     <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"
> type="DATE"/>
>       <column name="USERNAME" javaName="Username" required="false"
> type="VARCHAR" />
> 
>     </table>
> 
> Eric Pugh
> 
> -----Original Message-----
> From: Tuncay Baskan (Internet Grubu)
> [mailto:Tuncay.Baskan@intertech.com.tr]
> 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"
type="INTEGER"/>
	<column name="name" required="true" size="50" type="VARCHAR"/>
</table>


/tb.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message