Re: Criteria objects
From: VisionSet (spam_at_ntlworld.com)
Date: 08/24/04
- Next message: Cid: "Re: pdf in browser wrong language"
- Previous message: Cid: "Re: How can I trap UI events non-intrusively?"
- In reply to: Sudsy: "Re: Criteria objects"
- Next in thread: Chris Uppal: "Re: Criteria objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 24 Aug 2004 05:52:17 GMT
"Sudsy" <bitbucket44@hotmail.com> wrote in message
news:412AC575.8090507@hotmail.com...
> VisionSet wrote:
> <snip>
> > But I'm a little unhappy about this, a null primary key?
> >
> > Is this abuse of the object? should I have a separate criteria class?
> >
> > I'm after the simplest design that I do feel happy about.
>
> It's a perfectly valid approach (and one I've used). When you pass
> value-objects containing record data, using the same for search
> criteria makes sense. Ignore those fields which have been set to
> null and only search on the populated fields, even if they are
> empty Strings. So you're not actually searching for a null primary
> key in your example. You're indicating that you haven't specified
> the key and to not use it as part of the selection.
> I should mention that if the database generates the primary key
> automatically then setting it to null in the constructor is
> perfectly valid when creating a new record.
>
Thanks for the reply
When I use objects returned from the database I don't really want to have to
check for nulls in the fields.
But if I also use the class for criteria objects then I'm going to have to,
despite the fact I know my database won't return null fields my Record
documentation is going to say that null elements are valid.
-- Mike W
- Next message: Cid: "Re: pdf in browser wrong language"
- Previous message: Cid: "Re: How can I trap UI events non-intrusively?"
- In reply to: Sudsy: "Re: Criteria objects"
- Next in thread: Chris Uppal: "Re: Criteria objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|