Re: minimizing contact with the database

From: Steve Long <slong_at_ieee.org>
Date: Fri, 09 May 2003 02:17:29 GMT
Message-ID: <a2779515f01deacdedadeca86fcdea0f_at_TeraNews>


UPDATE...WHERE MyClassFK=n AND attribte=x"

"karl wettin" <wettin_at_users.sourceforge.net> wrote in message news:20030508075730.466145da.wettin_at_users.sourceforge.net...
>
> I'm trying to minimize the contact with my RDBMS from my application, only
> updating, inserting and removing entries that needs to be touched.
>
> My problem is when I have an unlimited sized list of attributes associated
> with a table. Example:
>
> MyClass:
> || PK || ...
>
> MyClass_attribute:
> || MyClassFK || attribute ||
>
> At commit-time, I know the value of attributes have been added and
removed,
> but the attribute isn't unique and there might be duplicates. I can't just
> pass a "DELETE FROM ... WHERE MyClassFK=n AND attribute=x", since that
> might remove more than the one attribute I had in mind.
>
> I want to solve this in the buisness layer, not in the persistent layer,
> thus I don't want to extend MyClass_attribute with unique PK:s.
>
> One solution would be to check if there are any duplicates when I gather
> the attributes from the persistent layer. If none, it safe to pass above
> query. If there are duplicates, and any duplicate has been touched, I have
> to remove ALL attributes and then insert them again.
>
> Are there any better solutions?
>
>
>
> karl
>
Received on Fri May 09 2003 - 04:17:29 CEST

Original text of this message