Re: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works?
Brought to you by:
thma
From: <Ste...@eu...> - 2002-06-06 16:28:14
|
hi jakob. Thank you for your help. It works OK with simple mapped objects (without using FieldConversion).= But there is a problem with object with some fields mapped through FieldCnversion. FieldConversion.javaToSgl() is not used during the Query resolving (it should be used probably in StatementManager.bindStatementValue() ). In Toplink they build up condition from all not null Object attribute values, not 0 int primitive attributes (char, int, ....), not false boolean attributes but it is possible to customize it by defining polic= y. Tnx Stefan |--------+----------------------------------------------> | | "Jakob Braeuchi" | | | <jbr...@ho...> | | | Odeslal: | | | obj...@li...urc| | | eforge.net | | | 05.06.2002 15:33 | | | | |--------+----------------------------------------------> >--------------------------------------------------------------------= ---------------------------------------| | = | | Komu: <obj...@li...>, <Stefan_T= am...@eu...> | | Kopie: = | | P=F8edm=ECt: Re: [ojb-users] Does getCollectionByQuery() = with QueryByExample argument works? | | = | | = | >--------------------------------------------------------------------= ---------------------------------------| hi stefan, QueryByExample is actually a query by identity. try new QueryByCriteria(exampleObj) this will build a QueryByExample us= ing 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 QueryByExampl= e 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=F8edm=ECt: 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 (primar= y key) > set only (all other attributes are null or 0). There is no unittest w= ith > such functionality. > > public Collection find(Object object) { > Query query =3D 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.cf= m > > _______________________________________________ > 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 _______________________________________________________________ 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 = |