db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CP Lim <cp_...@redsheriff.com>
Subject Re: autogenerate ID
Date Tue, 25 Nov 2003 22:21:40 GMT
Silviu,

Have a look at this:

http://www.mail-archive.com/torque-user@db.apache.org/msg01031.html

It sounds like you'll have to use the 'autoIncrement' attribute.

I fear I might have led you somewhat astray because I'm using postgresql.

HTH,
CP

Silviu Marcu wrote:

> I tried to use id-method-parameter - but no effect in the generated SQL
> file.
> Can you give me some idea what is used for id-method-parameter, becouse
> in torque 1.3 generator documentation there is no reference about it.
> 
> Thanks,
> silviu
> 
> -----Original Message-----
> From: CP Lim [mailto:cp_lim@redsheriff.com] 
> Sent: 25 noiembrie 2003 09:14
> To: Apache Torque Users List
> Subject: Re: autogenerate ID
> 
> Not sure about MySQL.  You can always try it and see if it'll generate 
> the correct java classes for you....
> 
> cheers,
> CP
> 
> Silviu Marcu wrote:
> 
> 
>>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


Mime
View raw message