Hi Tuncay

> Now, when I try to create a Task object and call save method I get a "cannot
> add child row, foreign key rule fails" message from MySQL. After long hours
> of digging in the source I found that when Criteria prepares the SQL it
> always puts "parent_id" column into the list. From my point of view, when I
> set required="false" Torque should not insist of taking "parent_id" into
> account. Is this a known problem, or am I making a mistake?

To create a top-level task, try explicitly setting parent_id to NULL.

Criteria crit = new Criteria();
crit.add(TaskPeer.PARENT_ID, (Object) (TaskPeer.PARENT_ID + " IS NULL"),
    Criteria.CUSTOM);

Does that work?

Eric

-- 
Eric Emminger
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to