Re: help with non decomposed M:N
Ramzi Oueslati <[email protected]>
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Armin, That solved my problem. Thank you so much. I spent so much time on it I was about to give up. Many thanks Armin. Armin Waibel a écrit : > Ramzi Oueslati wrote: >> Hi Armin, >> >> Thank you for your reply. Sure I can and here it is. >> >> This is when I try to update an already persisted instance of A : >> >> java.lang.NullPointerException >> at >> org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(DescriptorRepository.java:409) >> >> at >> org.apache.ojb.broker.core.MtoNBroker.getMtoNImplementor(MtoNBroker.java:129) >> > > Think I got your problem. The NPE is caused by a invalid mapping. > > Your look like: > > <collection-descriptor name="cs" > collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList" > > element-class="my.test.business.C" > auto-retrieve="false" auto-update="link" > indirection-table="TBLAC"> > <fk-pointing-to-this-class column="A_ID" /> > <fk-pointing-to-element-class column="C_ID" /> > </collection-descriptor> > > > a correct mapping look like: > > <collection-descriptor name="authors" > element-class-ref="org.apache.ojb.broker.sqlcount.BaseCountTest$Author" > indirection-table="SQLCOUNT_PUBLICATION" > proxy="true" > auto-retrieve="true" > auto-update="object" > auto-delete="object" > > > <fk-pointing-to-this-class column="MEDIUM_ID"/> > <fk-pointing-to-element-class column="AUTHOR_ID"/> > </collection-descriptor> > </class-descriptor> > > as you can see it differs in one attribute, you use "element-class" > instead of "element-class-ref" and this cause the NPE. > > By the way, it's recommended to use the latest version of OJB (1.0.4). > > Good luck! > regards, > Armin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > >