Criteria objects
From: VisionSet (spam_at_ntlworld.com)
Date: 08/24/04
- Next message: moonlight [rastislav komara]: "Re: What do you guys think of Hibernate?"
- Previous message: Keith: "Re: Remove unicode from SQL"
- Next in thread: Chris Uppal: "Re: Criteria objects"
- Reply: Chris Uppal: "Re: Criteria objects"
- Reply: Fredrik Bertilsson: "Re: Criteria objects"
- Reply: John C. Bollinger: "Re: Criteria objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 24 Aug 2004 05:14:45 GMT
I think there is a valid approach to retrieving records based on a criteria
object that is of the same class as the object you are retrieving.
A Record object may be used as the criteria to find other Record objects.
If we have a method such as
Record[] find(Record record);
then the argument can have any of its fields as null
this would signify no filtering on that field.
A criteria object could be set up as so:
public Record(Integer key, String[] data);
new Record(null, new String {"Foo", "Bar", null, null, null, null, null})
I think Hibernate uses this approach.
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.
-- Mike W
- Next message: moonlight [rastislav komara]: "Re: What do you guys think of Hibernate?"
- Previous message: Keith: "Re: Remove unicode from SQL"
- Next in thread: Chris Uppal: "Re: Criteria objects"
- Reply: Chris Uppal: "Re: Criteria objects"
- Reply: Fredrik Bertilsson: "Re: Criteria objects"
- Reply: John C. Bollinger: "Re: Criteria objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|