Re: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works?
Brought to you by:
thma
From: Jakob B. <jbr...@ho...> - 2002-06-05 13:33:42
|
hi stefan, QueryByExample is actually a query by identity. try new QueryByCriteria(exampleObj) this will build a QueryByExample using all non null values. this feature is not perfect (can't handel null i query, what about primitives ) and it's supported by QueryFactory. do you know how toplink handles this ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Wednesday, June 05, 2002 11:01 AM Subject: Re: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works? Yes, getObjectByQuery() work OK but it returns only one object, but I want to find Collection of object that fulfill conditions defined by "ExampleObject". We found it very flexibly to use "ObjectByExample" idea in our previous project (Toplink) to simplify finders API. Tnx, Stefan |--------+----------------------------------------------> | | "Jakob Braeuchi" | | | <jbr...@ho...> | | | Odeslal: | | | obj...@li...urc| | | eforge.net | | | 04.06.2002 19:11 | | | | |--------+----------------------------------------------> >--------------------------------------------------------------------------- ---------------------| | | | Komu: <obj...@li...>, <Ste...@eu...> | | Kopie: | | Předmět: Re: [ojb-users] Does getCollectionByQuery() with QueryByExample argument | | works? | | | | | >--------------------------------------------------------------------------- ---------------------| hi stefan, have you tried getObjectByQuery() ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Tuesday, June 04, 2002 5:50 PM Subject: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works? > What I do wrong? > > I call find() method with persistant object with id attribute (primary key) > set only (all other attributes are null or 0). There is no unittest with > such functionality. > > public Collection find(Object object) { > Query query = new QueryByExample(object); > return broker.getCollectionByQuery(query); > } > > It returns collection of all objects from DB. > > Tnx Stefan > > P.S. I have ojb 0.9 > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users |