Your sources look right.
You might have a look
are there getters and setters for your collection attribute "categories"?
Do you see any error messages or stacktraces?
There are no regression testcases for this feature yet, so it could also indicate a bug.
cheers
Gavin, Rick wrote:
Am i doing something wrong here, when i set the descriptor to auto-retrieve false and add the "retrieveReference" call, i get null for the property ...simple example.... does this not look right? the call to myobject.getCategories returns "null", but returns correctly if auto-retrieve is set to true; ------------------------ StringBuffer sb = new StringBuffer(); PersistenceBroker broker = Settings.getBroker(); if(broker!=null){ Query query = new QueryByCriteria(MyClass.class, null); try { Collection all = broker.getCollectionByQuery(query); Iterator iter = all.iterator(); while (iter.hasNext()) { MyClass myobject = (MyClass)iter.next(); broker.retrieveReference(myobject, "categories"); //*** help sb.append("<br>" + myobject.toString()); sb.append("<br>" + myobject.getCategories() + "<br>"); } } catch (PersistenceBrokerException pbex) { pbex.printStackTrace(); } } ------------------------- Thanks, Rick -----Original Message----- From: Mahler Thomas [mailto:thomas.mahler@;itellium.com] Sent: Thursday, November 07, 2002 7:06 AM To: 'OJB Users List' Subject: AW: [0.9.7] How do you get a collection when auto-retrieve is fal se? Hi Gavin, use PersistenceBroker::retrieveReference /** * retrieve a single reference- or collection attribute * of a persistent instance. * @param pInstance the persistent instance * @param pAttributeName the name of the Attribute to load */ public void retrieveReference(Object pInstance, String pAttributeName) throws PersistenceBrokerException; cheers, Thomas-----Urspr�ngliche Nachricht-----
Von: Gavin, Rick [mailto:RGavin@;vidyah.com]
Gesendet: Donnerstag, 7. November 2002 15:50
An: [EMAIL PROTECTED]
Betreff: [0.9.7] How do you get a collection when auto-retrieve is
false?
If you have queried for an entity with auto-retrieve off in the descriptor..
(most of the time the data isn't needed) how do you tell it pragmatically
to load the collection into the object? Sorry if its a dumb question, I
didn't see it in the docs.
--------------------------------------------------------------
-----------
<collection-descriptor
name="categories"
element-class-ref="Category"
auto-retrieve="false"
auto-update="false"
auto-delete="false"
>
<inverse-foreignkey field-id-ref="2"/>
</collection-descriptor> --------------------------------------------------------------
------------
Thanks for any help,
Rick
--
To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
-- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
-- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
