Re: [OJB-developers] query based on example object
Brought to you by:
thma
From: Jakob B. <jbr...@ho...> - 2002-03-19 06:51:11
|
hi thomas, the solution in it's current state is quite simple: it only uses non null instvars to produce EqualsToCriteria. problems arise with primitives as the can't be null. i thought of some kind of include/exclude lists, but it's not implemented yet. jakob ----- Original Message ----- From: "Thomas Mahler" <tho...@ho...> To: "Jakob Braeuchi" <jbr...@ho...> Cc: <obj...@li...> Sent: Monday, March 18, 2002 9:12 PM Subject: Re: [OJB-developers] query based on example object > 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 > > > > > > > > > > > |