arnoldj wrote:
I have two classes defined:
public class ApplicationSpecification implements Serializable {
private String id;
private String vendor;
private String name;
private String version;
private boolean rebootRequired;
private java.lang.String installationNotes;
private String description;
private boolean licenced;
}
public class ApplicationInstance extends ApplicationSpecification {
private String appInstId;
private String installationOrder;
private String notes;
private String businessUnit;
private String buildVersion;
private String language;
private String descriptor;
private boolean visible;
private String version;
}
One ApplicationSpecification is the specification for many ApplicationInstances. An ApplicationInstance is a superclass of a Specification, but they do not have the same primary id. An ApplicationInstance also has its own id.
To model this in the database I have separate tables that map exactly to the Specification and Instance tables.
The Specification table has a PK of AS_ID.
The Instance table also has a PK of AI_ID.
The Instance table also has a FK into Specification, namely AI_AS_ID.
How do I model this within the XML mapping document?
Any help would be appreciated with this as I have been working on this problem for a couple of days now and cannot see a way that it can be modelled using hibernate.
Thanks,
Julian.
You should use agregation instead of superclass i.e :
Code:
public class ApplicationInstance extends ApplicationSpecification {
private ApplicationSpecification applicationSpecification;
.....
}
[/code][/quote]