You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Clute, Andrew" <An...@osn.state.oh.us> on 2003/09/10 23:14:30 UTC
RE: Xdoclet: How to use base-class properties with different colu
mn n ames in children?
Ok, well I figured out that the version of Xdoclet-ojb that comes compiled
with RC4 does not have this feature in it.
I downloaded the most recent jar from CVS, and now it works, sort of.
If it put my @ojb.field description in the class comment, it will now had
the field-description, but now it always sets the access="anonymous", even
if I specify an access="readwrite" for that field.
Ways around this?
-----Original Message-----
From: Clute, Andrew [mailto:Andrew.Clute@osn.state.oh.us]
Sent: Wednesday, September 10, 2003 3:45 PM
To: 'ojb-user@db.apache.org'
Subject: Xdoclet: How to use base-class properties with different column n
ames in children?
So, let's say I have a base class 'BusinessObject' with a property called
'guid'
So, I have two classes, both extend BusinessObject, named 'dog' and 'cat'.
My database (which already exist), has a field in the tbl_dog table called
"dog_guid", and the tbl_cat has "cat_guid".
Before using Xdoclet to get my repository_user.xml, I would define the
mapping for both dog and cat's guid, cooresponding the appropriate column
name for that table, and the name of the field in the base class.
I can't seem to find the same way to do it in Xdoclet-ojb -- It seems I have
to have a property named "guid" in each of my child classes to attach an
xdoclet tag to it.
I have tried this:
<code>
/**
* @ojb.class table="tbl_cat"
* include-inherited="true"
* @ojb.field name="guid"
* column="cat_guid"
* jdbc-type="VARCHAR"
*/
Public class Cat extends BusinessObject
</code>
But, it doesn't create the reference in the xml file. However, if I put a
property called guid in the dog and cat classes, and the tag that, it works
-- but that stinks because I am killing OO.
Thoughts?
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Xdoclet: How to use base-class properties with different column
names in children?
Posted by Thomas Dudziak <to...@first.gmd.de>.
It seems you've found a bug in the module. The ability to define fields
etc. in the class javadoc comment is provided to accomplish two
things. The first one is to define anonymous fields and relations. This
works. The second one is to change attributes of elements already defined
in base types. This is your case, and it seems to be not working properly.
Your solution however does not handle the actual problem but only works in
your case. I will have a look at it and fix it ASAP. As for the source
code, sadly the module is still not part of the xdoclet CVS, but you can
grab the source from the xdoclet JIRA space (entry XDT-514 if I'm not
mistaken, see the xdoclet page for details), though the version there is
rather old. The next update the module will come in a couple of days, and
then I will update the source code in JIRA, as well.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org