Hello,
I am trying to use
inheritance with my entity beans. For example I would want my EmployeeBean
to inherit from my PersonBean. I have no problem doing that at all.
The only problem is, I am only able to do that for one-table mapping. I
would like to use inheritance but with horizontal type
mapping.
To give you a
concrete example of what Horizontal mapping is (in case you don't know), we will
suppose that my Person bean has attributes id and name. The
Employee bean (which inherits from Person) has a employeeNumber. Both
of these entity beans would be mapped to a table: Employee would have columns
id, name and employeeId and Person would have columns id and name. When I
create an Employee, I would like the mapping to be made for both tables.
Consequently, if I create employee: name = John Smith, id = 123,
employeeNumber = 12345, both the Employee table and the Person table would be
updated. Does anybody know how this could be done?
I was thinking of
overloading the setEmployeeValue so that it not only sets the Employee but also
fetches the Person and sets it (if it exists). I would call this
method from the ejbPostCreate of the Employee but I'm pretty sure
there has to be an easier solution. Otherwise, does anybody know why
I can't seem to override the setEmployeeValue that is in the CMP by
writing my own method in the bean?
You can get more
info on Horizontal, One-Table and Vertical mapping at the following
link:
Any suggestion would
be greatly appreciated,
Fran�ois
