Re: AW: [OJB-developers] Using CollectionDescriptor in repository.xml
Brought to you by:
thma
From: Leandro R. S. C. <le...@ib...> - 2002-03-22 15:55:15
|
Sorry man, in fact the problem was in another line at repository.xml I defined a ReferenceDescriptor that pointed to the wrong class field. By the way. If I have a association like this A 1 ----- N B Do I have to defined CollectionDescriptors(from A to B) and ReferenceDescriptos( from B to A) or just one of them ?? On Fri, 2002-03-22 at 12:20, Mahler Thomas wrote: > Hi Leandro, >=20 > I'll try to explain the 1-n section from the tutorial3. > Say you have a class ProductGroup with a Vector attribute allArticlesInGr= oup > that holds all Article objects belonging to this group. >=20 > That is: *one* ProductGroup holds *n* Articles. >=20 > 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> > ... >=20 > 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 >=20 > HTH, >=20 > Thomas >=20 > > -----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 --=20 Leandro Rodrigo Saad Cruz IT - Inter Business Tecnologia e Servicos (IB) http://www.ibnetwork.com.br |