These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Query By Example & identifiers
PostPosted: Wed Sep 19, 2007 10:14 am 
Newbie

Joined: Fri Jan 19, 2007 1:42 pm
Posts: 6
Im using QBE and noticed that it ignores the identifier property - is this correct?

Obviously for an int or whatever I can use Get or Load (so it makes no sense to use QBE on a unique identifier) but if my PK is a string I might want to search for a LIKE via the EnableLike (and correct MatchMode) on the Example

Another reason I might need this is for tables with composite keys when the various properties are not exposed on the containing object (so I can can find all records that match just one of the keys that makes up the identifier)

Is it not misleading when I can write code like:
Code:
Cat cat = new Cat();
cat.Id = 1;

repository.GetByExample<Cat>(cat);

or
Code:
Cat cat = new Cat();
CatId catId = new CatId();
catId.CompositeKey1 = "some value";//search by one of the composite keys
cat.Id = catId;
repository.GetByExample<Cat>(cat);

and the result will be every cat in the database.

I now know not to use QBE for the ID and will expose the any composite key properties as properties on the parent object but I would be interested in knowing why the identifier is excluded.

many thanks

W


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.