Re: [OJB-developers] query based on example object
Brought to you by:
thma
From: Thomas M. <tho...@ho...> - 2002-03-18 20:12:55
|
Hi Jakob, This looks like a useful feature! When I first implemented QueryByExample (QBE) I did only implement a primary key based version. I did not implement a generic solution as I found some difficulties. Imagine, you don't call example.setTest(11); The respective attribute will then be == 0; How can we distinguish such an "un-willed" zero from a "willed" example.setTest(0); There are similar problems for null String attributes. Did you address these problems in your solution? cu, Thomas Jakob Braeuchi wrote: > hi , > > i just comitted a small feature to the cvs: building a QueryByCriteria based > on an example object. > > Person example = new Person(); > Query query; > > example.setBoss(false); > example.setTest(11); > example.setName("Br%"); > query = new QueryByCriteria(example); > > this will build a QueryByCriteria with the following criteria: > boss = false AND test=11 AND name like "Br%" > > i didn't want to change the class QueryByExample nor the method > newQuery(Object obj) of class QueryFactory because > QueryByExample uses the Identity to retrieve Objects. Actually > QueryByExample could be renamed QueryByIdentity... > > jakob > > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > > > > |