I have these two tables :
<table name="DOCUMENT" skipSql="false" >
<column name="doc_Id"required="true" type="INTEGER" primaryKey="true"/>
...
</table>
<table name="ACCESS" idMethod="none" skipSql="false"/>
<column name="doc_Id" required="true" type="INTEGER"/>
<column name="group_Id" required="true" type="INTEGER"/>
<foreign-key foreignTable="DOCUMENT">
<reference local="doc_Id" foreign="doc_Id"/> <--------*-------
</foreign-key>
</table>
And the associated code :
Document newDoc = new Document( );
//Set its attributes
newDoc.setXXX
newDoc.setXXX
newDoc.save();
Access newAccess = new Access( );
newAccess.setDocument( newDoc ); <--------*---------
newAccess.setGroupId( ... );
newAccess.save();
When I try newAccess.save() I get an error wich says that
ACCESS.doc_Id cannot be null !?!
Shouldn't this column be filled up automaticly by Torque with
newDoc.getDocumentId() ?
If I comment the marked line from the code and add
newDoc.addAccess( newAccess );
newDoc.save();
everything works fine.
What is wrong in the first approach ?
Thanks in advance.
Felix
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>