----- Message from Thomas Dudziak <[EMAIL PROTECTED]> on Fri, 17 Sep 2004 22:51:01 +0200 ----- To:OJB Users List <[EMAIL PROTECTED]> Subject:Re: Xdoclet, reference and modify-inherited Mickael LEFEVRE wrote: > We use OJB 1.0.1 with one class per table. > To be simple, we have 3 classes : B extend A, and A have a reference to C. > The C id in A is anonymous. > A have the flag ' determine-extends="false" ' > > In B we could ignore the reference to C, but not the C id (which is > anonymous). > If we put : > > * // reference > * @ojb.modify-inherited name="C" > * ignore="true" > * > * // foreignkey of the reference > * @ojb.modify-inherited name="CId" > * ignore="true" > > xdoclet-ojb simply reply : > <> although this field is ignored in this class>> > > If I delete : > * @ojb.modify-inherited name="CId" > * ignore="true" > the ant task did well, but the field CId is present in the mapping of B. > That give bad SQL request on the database server, like if the field CId is > in the table associated to C. > > We try to delete the anonymous CId field in the B mapping, and our test > succeed. > We could access the C reference from B. No bad join, or bad place field in > the SQL request. > > Is it a bug, a feature, or something else ? You've hit a bug. The constraint was checked for the reference even though it is ignored. I fixed that in CVS (both stable and 1.1-dev). You can get the new module jar here: http://cvs.apache.org/viewcvs.cgi/*checkout*/db-ojb/lib/xdoclet-ojb-module-1.2.1.jar --- Really cool, the mapping was generated as espected for the reference from A -> C, and B. I don't know if it's a side effect, but our persistance layer is just more complicated, and we have some more classes ;) We also have a D class which extends C. C have a collection of A, and the D mapping is : * @ojb.modify-inherited name="myCollectionOfA" * ignore="true" Now the B mapping is : * @ojb.modify-inherited name="C" ignore="true" * @ojb.modify-inherited name="CId" ignore="true" The ant task just reply : Cannot ignore field CId in class B because it is used in A as a foreignkey of the collection myCollectionOfA from class D Any idea ? regards, Micha�l --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
