Re: Cascade delete with optional to-one relationship
Re: Cascade delete with optional to-one relationship
- Subject: Re: Cascade delete with optional to-one relationship
- From: email@hidden
- Date: Mon, 20 Oct 2003 17:15:39 CDT
- Priority: 3 (Normal)
[demime could not interpret encoding binary - treating as plain text]
It's definitely possible to have a cascade delete on an optional
relationship. That's not where your problem is coming from.
Here's what I see from your information:
The EO being deleted DID have a foreign key for the optional
relationship. That column should be null if there is no relationship, but
it's not null, it's apparently BigDecimal 2.0000.... . But there's no
destination with pk 2.
In EOF, if the relationship is not set, the foreign key should be null.
It should not be some value that doesn't actually have a corresponding B
object.
Additionally, it's a big odd to use BigDecimal for a PK/FK. But I don't
think it should cause any problems (using a floating point type for a
pk/fk definitely would! But that's not what this appears to be). But
maybe this is just some weird EOF artifact we don't need to worry about.
At any rate, I dont' think it's causing this problem.
Does this make sense?
--Jonathan
On Mon, 20 Oct 2003 17:08:26 -0500 "Albert Jagnow" wrote:
> It is possible to use cascade delete on an optional to-one relationship.
> For example I have table A and table B where table A has an optional
> to-one relationship to table B. Most of the time table A will have no
> table B object, but if table A does have a relationship to table B and
> the table A object is deleted I want the table B object deleted as well.
> I assume I would set the relationship to optional and the delete rule to
> cascade in EOModeler to accomplish this. However if I do this and I try
> to delete a table A object with no table B relationship I get the
> following error:
>
> recordDeleteForObject: com.webobjects.eoaccess.EODatabaseContext
> com.webobjects.eoaccess.EODatabaseContext@242445 failed to find a
> snapshot for EO with Global ID:_EOIntegralKeyGlobalID[TableB
> (java.math.BigDecimal)2.000000000000000000000000000000] that has been
> deleted from
> com.webobjects.eocontrol.EOEditingContextcom.webobjects.eocontrol.EOEdit
> ingContext@5ae101. Cannot delete an object that has not been fetched
> from the database
>
> It looks like WO is trying to delete the table B object even though it
> does not exist. Am I doing this wrong or is this some kind of bug?
>
>
> --Albert
>
>
> This e-mail (including any attachments) is covered by the Electronic
> Communications Privacy Act, 18 USC. 2510-2521. It is confidential and
> may be legally privileged. If you are not the intended recipient, you
> are hereby notified that any retention, dissemination, distribution, or
> copying of this communication is strictly prohibited. Please reply to
> the sender that you have received the message in error, and then delete
> it. Thank you.
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.