On Sunday 01 September 2002 11:53 pm, Peter Courcoux wrote: > Hi all, > > I have seen several posts to various lists about torque, postgresql > sequences and autoincrementing primary keys. However, it is not clear > whether anyone has successfully managed to configure torque to use > postgresql's native sequences. So my question : has anyone successfully > managed this with torque b4 and if so a short howto would be gratefully > received. > > Regards, > > Peter
yes - I use postgresql sequences to auto-generate keys. Assuming that you have defined your sequences in the database (note: naming "may" be important, I use the format "<tablename>_<columnname>_SEQ"), I think its mostly the schema.xml that you need to configure. Make sure you either set the <database defaultIdMethod="native"> or specific <table idMethod="native"> and for each relevant <table> add the element <id-method-parameter value="your-sequence-name-here"/>. Not forgetting to ensure that each primary key <column> element has primaryKey="true" and autoIncrement="true" (mine are also all type="INTEGER"). I think that's all I did. Seems to work OK. I couldn't get torque to create the database though - I had to create it seperately. I personally don't like the idea of having a specific ID table to create all keys - it could become a hotspot and affect concurrent inserts. Pete -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
