Excellent! That seems to have worked. I remove the ojb.reference from the ojb.class tag and moved the ojb.reference tag into the javadoc comment of the concrete subclass.

Now on to another issue.

/**
* @ojb.class table="CA_PROJECT_T"
*/
public class ProjectCode {
 /**
  * @ojb.field column="PROJECT_CODE"
  * jdbc-type="VARCHAR" primarykey="true"
  */
  private String code;
}

---

/**
* @ojb.class table="PROJ_DOC" include-inherited="true"
*/
public class ProjectCodeDocument extends ProjectCode implements SubClassOfDocument {
}


---

When I run the XDoclet OJB Ant task on this source tree I get:

xdoclet.XDocletException: The number of foreignkeys (1) of the reference projectCode doesn't match the number of primarykeys (2) of the referenced class (or its subclass) org.my.bo.ProjectDocument.

---

Now the trick here is that nothing refers directly to ProjectCodeDocument. The Java code only ever refers to ProjectCode instances. ProjectCodes will only ever be looked up by their "code" field. ProjectCodeDocuments will only ever be looked up by their documentHeaderId.

In fact there are no references (yet) in the source tree to ProjectCodeDocument at all.

So is it the case that if B extends A, A declares a primary key, and B declare a different primary key, all lookups of instances of B must be done by BOTH primary keys?

TIA - again.

Laran Evans

Thomas Dudziak wrote:

You can use the ojb.reference tag in the class' javadoc comment only
for one purpose: stating the super reference (the name attribute is
ignored, though I think I should add an error message if it is in
place and specifies something different than 'super') which is used
for mapping hierarchies to multiple tables (see
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Extents+and+Polymorphism
for details).

Depending on whether you want to have the reference descriptor in the
class descriptor of Document you either have to specify a getter
and/or setter in this interface and specify the ojb.reference tag in
its javadoc comment (this also requires you to change the
PersistentFieldClass in OJB.properties to introspector or autoproxy).
Or, since there probably is no reason to have this reference in the
class descriptors for the interfaces, you simply put the ojb.reference
tag into the javadoc comment of the corresponding field in
ConcreteSubtypeOfDocument.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to