I have this class which has a reference to itself as parent:
Code:
public class Vendor extends VObject {
private String id;
private String name;
private Timestamp timestamp;
private String companyName;
private String contactName;
private Vendor vendor;
private Set vendors = new HashSet();
private String contactCellNo;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Timestamp getTimestamp() {
if (timestamp==null) timestamp = new Timestamp(System.currentTimeMillis());
return timestamp;
}
public void setTimestamp(Timestamp value) {
timestamp = value;
}
public String getCompanyName() {
return this.companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getContactName() {
return this.contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName;
}
public Vendor getVendor() {
return this.vendor;
}
public void setVendor(Vendor vendor) {
this.vendor = vendor;
}
public void setVendors(Set vendors) {
this.vendors = vendors;
}
public String getContactCellNo() {
return this.contactCellNo;
}
public void setContactCellNo(String contactCellNo) {
this.contactCellNo = contactCellNo;
}
public Set getVendors() {
return this.vendors;
}
}
My problem is simply this:
(a) All the examples assumes that "children" should for some odd reason always be e different class.
(b) According to the reference manual:
* It does not matter if a one-to-many relationship point to the same column/table
* Only one end of the relationship should be marked as readonly.
(c) If tried it does not work.
(d) The DTD does not allow for a <set> element to hava "readonly" attrib. If i drop it expects a "role" attribute (which is rejected once again by the DTD).
(e) If i leave the role attrib I get a massive milelong nullpointer exception; I traced the exception, and I ended up in Root class which expects a role attribute.
Where did i go wrong? I scanned the FAQ, and tutorials. I simply dont have the time to spent on browsing the www anymore.