AW: [OJB-developers] Using CollectionDescriptor in repository.xml
Brought to you by:
thma
From: Mahler T. <tho...@it...> - 2002-03-22 15:21:05
|
Hi Leandro, I'll try to explain the 1-n section from the tutorial3. Say you have a class ProductGroup with a Vector attribute = allArticlesInGroup that holds all Article objects belonging to this group. That is: *one* ProductGroup holds *n* Articles. You must tell OJB how to load the allArticlesInGroup attribute on = loading a ProductGroup object. This is done by the following CollectionDescriptor: <ClassDescriptor id=3D"2"> <class.name>test.ojb.broker.ProductGroup</class.name> ... <CollectionDescriptor id=3D"1"> <cdfield.name>allArticlesInGroup</cdfield.name> <items.class>test.ojb.broker.Article</items.class> <inverse_fk_descriptor_ids>4</inverse_fk_descriptor_ids> </CollectionDescriptor> ... This descriptor contains the following info: - The class ProductGroup has a container attribute allArticlesInGroup.=20 The Java-type of this attribute is not declared. It maybe of type SomeType[],=20 Collection, or ManageableCollection. - The Items in this Container are of type Article - The Mapping of class Article has a attribute with id=3D"4" that holds = a=20 foreign key value idetifying the associated ProductGroup. HTH, Thomas > -----Urspr=FCngliche Nachricht----- > Von: Leandro Rodrigo Saad Cruz [mailto:le...@ib...] > Gesendet: Freitag, 22. M=E4rz 2002 15:30 > An: obj...@li... > Betreff: [OJB-developers] Using CollectionDescriptor in = repository.xml >=20 >=20 > Hi all. There is one thing I didn't understand from the docs about > association mapping > http://objectbridge.sourceforge.net/tutorial3.html#1-n >=20 > <CollectionDescriptor id=3D"1"> > <cdfield.name>collection</cdfield.name>=20 > ******* -> does this field must be present in repository.xml in > SomeCLASS ClassDescriptor ? or just be a field in SomeCLASS impl ? >=20 > <items.class>SomeCLASS</items.class> > <inverse_fk_descriptor_ids>2</inverse_fk_descriptor_ids> > </CollectionDescriptor> >=20 > I keep getting exceptions like this : > Expcetion : java.util.NoSuchElementException > StackTrace: java.util.NoSuchElementException at > ojb.broker.accesslayer.RsIterator.next(RsIterator.java) at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:931)at=20 > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:1000)at=20 > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:1093)at=20 > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:1080)at > .... >=20 > that doesn't help me so much. >=20 >=20 > --=20 > Leandro Rodrigo Saad Cruz > IT - Inter Business Tecnologia e Servicos (IB) > http://www.ibnetwork.com.br >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |