Hi all, and sorry for the wait ( my child needed a long story to sleep )
Here are Person <---- Salary and the repository generated.
The problem is on Salary(id) which is pk of salary and fk on
Persons(id). As Salary has no id ( it's inherited ) I have to put @field
in class metadoc ===> so access is anonymous as expected but I like to
keep the access value of inherited field
<class-descriptor
class="com.amdm.ojbdemo.model.Salary"
table="salaries"
>
<field-descriptor
name="id"
column="id"
jdbc-type="BIGINT"
primarykey="true"
access="anonymous"
>
should become ( removal of access="anonymous" )
<class-descriptor
class="com.amdm.ojbdemo.model.Salary"
table="salaries"
>
<field-descriptor
name="id"
column="id"
jdbc-type="BIGINT"
primarykey="true"
>
I'd like to keep the access attribute of inherited field
Thanks
> > Using xdoclet for generating mapping file brings us to put an
> > @ojb.reference name="id" in Class B header, but for this to work we need
> > to declare id as anonymous field of B ( @ojb.field also in header ).
> >
> > As consequence id of A is never filled with db data ( anonymous ). If we
> > change access="readonly" in mapping all is alright.
> > The problem is that when @ojb.field are in header the attribute "access"
> > is ignored ( as described in doc ).
> >
> > Is there a way to work with this strategie of inheritance mapping and
> > xdoclet.
> >
> > In the sample class B redefines attribute id, with @ojb.field at field
> > level, this works, but "id" of class "A" is hidden.
>
> Could you post the classes with the tags as you're using them, and the
> repository_user.xml part as it is generated and as you'd like to have it ?
>
> Tom
>
/*
* Created on 23 avr. 2004
* By Olivier Nouguier
*
*/
package com.amdm.ojbdemo.model;
import java.util.Collection;
import java.util.Vector;
/**
* @author Olivier Nouguier
* @ojb.class table = "Persons"
* determine-extents = "false"
*/
public class Person implements PersonInterface{
/**
* @ojb.field primarykey="true"
* autoincrement="ojb"
* sequence-name="persons_id_seq"
*
*/
private long id;
/**
* @ojb.field
*/
private String lastname;
/**
* @ojb.field
*/
private String firstname;
private Collection roles;
private Collection offices = new Vector();
public Person(){
}
/**
* @param string
* @param string2
*/
public Person(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
/**
* @return Returns the firstname.
*/
public String getFirstname() {
return firstname;
}
/**
* @param firstname The firstname to set.
*/
public void setFirstname(String firstname) {
this.firstname = firstname;
}
/**
* @return Returns the id.
*/
public long getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(int id) {
this.id = id;
}
/**
* @return Returns the lastname.
*/
public String getLastname() {
return lastname;
}
/**
* @param lastname The lastname to set.
*/
public void setLastname(String lastname) {
this.lastname = lastname;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return "[Person]" + getId() +": " + getLastname() + " " + getFirstname();
}
/**
* @return Returns the offices.
*/
public Collection getOffices() {
return offices;
}
/**
* @return Returns the roles.
*/
public Collection getRoles() {
return roles;
}
}
/*
* Created on Jun 9, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.amdm.ojbdemo.model;
/**
* @author manwe
*
* @ojb.class table = "salaries"
* include-inherited = "false"
*
* @ojb.field name="id"
* jdbc-type="BIGINT"
* primarykey="true"
*
* @ojb.reference class-ref="com.amdm.ojbdemo.model.Person"
* foreignkey="id"
*
*/
public class Salary extends Person {
private double income;
/**
* @return Returns the income.
* @ojb.field
*/
public double getIncome() {
return income;
}
/**
* @param income
* The income to set.
*/
public void setIncome(double income) {
this.income = income;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
// TODO Auto-generated method stub
return super.toString() + " " + income;
}
}<!-- file containing the repository descriptions for user-defined types -->
<!-- Generated by the xdoclet-ojb module -->
<class-descriptor
class="com.amdm.ojbdemo.model.Person"
table="Persons"
>
<field-descriptor
name="id"
column="id"
jdbc-type="BIGINT"
primarykey="true"
autoincrement="true"
sequence-name="persons_id_seq"
>
</field-descriptor>
<field-descriptor
name="lastname"
column="lastname"
jdbc-type="VARCHAR"
length="254"
>
</field-descriptor>
<field-descriptor
name="firstname"
column="firstname"
jdbc-type="VARCHAR"
length="254"
>
</field-descriptor>
</class-descriptor>
<class-descriptor
class="com.amdm.ojbdemo.model.Salary"
table="salaries"
>
<field-descriptor
name="id"
column="id"
jdbc-type="BIGINT"
primarykey="true"
access="anonymous"
>
</field-descriptor>
<field-descriptor
name="income"
column="income"
jdbc-type="FLOAT"
>
</field-descriptor>
<reference-descriptor
name="super"
class-ref="com.amdm.ojbdemo.model.Person"
>
<foreignkey field-ref="id"/>
</reference-descriptor>
</class-descriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]