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 21:45:11 UTC

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?