db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject Re: Nullable columns as foreign keys fail
Date Tue, 18 Feb 2003 20:45:44 GMT
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"),

Does that work?


Eric Emminger

View raw message