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 Clóvis Wichoski <cl...@uol.com.br> on 2004/06/25 14:34:03 UTC

XDoclet throws xdoclet.XDocletException when do a reference to same class

Hi,

I'm attempting to map a reference to same class using XDoclet, but I'm 
geting the Exception on build:

xdoclet.XDocletException: The class Person referenced by myCreator in 
class Person is not persistent

Maybe this is a Bug or there is another way to map references to same class?

follow are the way that I'm mapping:

/**
* @ojb.class table="PERSON"
* @ojb.field name="myCreatorOid"
*            column="MY_CREATOR"
*            jdbc-type="VARCHAR"
*/
public class Person {
    /**
    * @ojb.field column="OID"
    *            length="8"
    *            primarykey="true"
    **/
    public String oid;

    /**
    * @ojb.reference foreignkey="myCreatorOid"
    */
    Person myCreator;

}

and the DDL is:
CREATE TABLE PERSON (OID VARCHAR(8), MY_CREATOR VARCHAR(8), PRIMARY 
KEY(OID))


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: XDoclet throws xdoclet.XDocletException when do a reference to same class

Posted by Thomas Dudziak <to...@first.fhg.de>.
Clóvis Wichoski wrote:

> Hi Thomas,
>
> I'm using the version 1.0.rc7 from binary distribution 
> (db-ojb-1.0.rc7.tgz), but I found the trouble, I passed to you only 
> the part of class that I think that is with the error, but there as a 
> mapping to a collection of other class, but this class isn't mapped, 
> then this invalidades the persistent state of Person and  throws the 
> exception, then I removed the mapping for this collection and works 
> here too.
> Sorry this is my fault, now I will put all XDoclet in all classes 
> before testing xdoclet-ojb generation of repository, in next time I 
> will take more care.

no problem, and it was beneficial because I added another test case to 
verify that your scenario works with the xdoclet ojb module.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: XDoclet throws xdoclet.XDocletException when do a reference to same class

Posted by Clóvis Wichoski <cl...@uol.com.br>.
Hi Thomas,

I'm using the version 1.0.rc7 from binary distribution 
(db-ojb-1.0.rc7.tgz), but I found the trouble, I passed to you only the 
part of class that I think that is with the error, but there as a 
mapping to a collection of other class, but this class isn't mapped, 
then this invalidades the persistent state of Person and  throws the 
exception, then I removed the mapping for this collection and works here 
too.
Sorry this is my fault, now I will put all XDoclet in all classes before 
testing xdoclet-ojb generation of repository, in next time I will take 
more care.

Thanks

Thomas Dudziak wrote:

> Clóvis Wichoski wrote:
>
>> Hi,
>>
>> I'm attempting to map a reference to same class using XDoclet, but 
>> I'm geting the Exception on build:
>>
>> xdoclet.XDocletException: The class Person referenced by myCreator in 
>> class Person is not persistent
>>
>> Maybe this is a Bug or there is another way to map references to same 
>> class?
>>
>> follow are the way that I'm mapping:
>>
>> /**
>> * @ojb.class table="PERSON"
>> * @ojb.field name="myCreatorOid"
>> *            column="MY_CREATOR"
>> *            jdbc-type="VARCHAR"
>> */
>> public class Person {
>>    /**
>>    * @ojb.field column="OID"
>>    *            length="8"
>>    *            primarykey="true"
>>    **/
>>    public String oid;
>>
>>    /**
>>    * @ojb.reference foreignkey="myCreatorOid"
>>    */
>>    Person myCreator;
>>
>> }
>
>
>
> I just added a testcase that mimics your scenario, and it passes 
> without problems. Which version of the xdoclet ojb module do you use ? 
> Please try with the CVS version, you can get the three jars - xdoclet, 
> xjavadoc, xdoclet-ojb-module, from the CVS view on the OJB website.
>
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: XDoclet throws xdoclet.XDocletException when do a reference to same class

Posted by Thomas Dudziak <to...@first.fhg.de>.
Clóvis Wichoski wrote:

> Hi,
>
> I'm attempting to map a reference to same class using XDoclet, but I'm 
> geting the Exception on build:
>
> xdoclet.XDocletException: The class Person referenced by myCreator in 
> class Person is not persistent
>
> Maybe this is a Bug or there is another way to map references to same 
> class?
>
> follow are the way that I'm mapping:
>
> /**
> * @ojb.class table="PERSON"
> * @ojb.field name="myCreatorOid"
> *            column="MY_CREATOR"
> *            jdbc-type="VARCHAR"
> */
> public class Person {
>    /**
>    * @ojb.field column="OID"
>    *            length="8"
>    *            primarykey="true"
>    **/
>    public String oid;
>
>    /**
>    * @ojb.reference foreignkey="myCreatorOid"
>    */
>    Person myCreator;
>
> }


I just added a testcase that mimics your scenario, and it passes without 
problems. Which version of the xdoclet ojb module do you use ? Please 
try with the CVS version, you can get the three jars - xdoclet, 
xjavadoc, xdoclet-ojb-module, from the CVS view on the OJB website.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org