db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Silviu Marcu" <sma...@lasting.ro>
Subject RE: autogenerate ID
Date Tue, 25 Nov 2003 06:59:34 GMT
Thanks for your answer,
Do you know the equivalent value for MySQL?

Regards,
Silviu

-----Original Message-----
From: CP Lim [mailto:cp_lim@redsheriff.com] 
Sent: 24 noiembrie 2003 23:20
To: Apache Torque Users List
Subject: Re: autogenerate ID

Hi Silviu,

What you can do is include the <id-method-parameter/> attribute to your 
table definition.  I'm using postgresql and it seems to work fine.  The 
following is an example:

--------------------------
<database name="test" defaultIdMethod="native" 
defaultJavaNamingMethod="javaname" package="test">
     <table name="cpl_test" idMethod="native">
         <column name="id" type="INTEGER" required="true" 
primaryKey="true"/>
         <column name="name" type="VARCHAR" size="100"/>

         <id-method-parameter value="cpl_test_id_seq"/>
     </table>
</database>
--------------------------

This worked properly for me, and the SQL generated includes creating the

sequence called 'cpl_test_id_seq' which is used to default the id
column.

HTH,
CP

Silviu Marcu wrote:

> Hi,
> I try to use a table with auto generate ID,
> I put
> <database  name="test"  defaultIdMethod="native"
> defaultJavaNamingMethod="javaname"  package="test">
> and the tables does not define the idMethod property.
> I dont see any changes in the generated sql file and in the code.
>  
> Can I generate classes that are not depending on DB name? (at
generation
> time, the map folder contains files that contains encoded the DB
name)?
> 

-- 
R E D S H E R I F F
C.P. Lim - Senior Software Engineer
[cp_lim@redsheriff.com]

96-98 Market St    +61 (3) 9606 4036 tel
South Melbourne    +61 (3) 9606 4001 fax
Victoria  3205     +61 (413) 781 846 cell

This message and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are

addressed. If you are not the intended recipient, you are hereby 
notified that any use or dissemination of this communication is strictly

prohibited. If you have received this message in error please notify us 
immediately by return email or telephone +61 (2) 8204 5888, then delete 
this message. Any views expressed in this message are those of the 
individual sender and many not necessarily reflect the views of Red 
Sheriff.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message