Hi:
I have three tables in a DB: User, Employee, and Consultant. Each Employee or Consultant is a User. The table User contains basic data pertinent to both Employees and Consultants (such as the name, e-mail address, username, etc.). The tables Employee and Consulant contain other relevant data elements. When an employee or a consultant logs in, the login is checked against User, and then we work with their tables.
Employee-User and Consultant-User have one-to-one relationships, and the ID for an Employee/Consultant is the same as the ID for the User.
What I would like to have is a mapping to:
Code:
public class User implements Serializable {
...
}
public class Employee extends User implements Serializable {
...
}
public class Consultant extends User implements Serializable {
...
}
I've had a look at the test files that come bundled with Hibernate, but found no indication at to how that could be implemented (incl. a correct Hibernate2 implementation of the one-to-one relationship)
I don't mind changing the DB/Class design either, if you have such suggestions.
Thanks in advance