I am trying to make sure I understand how hibernate handles inheritance. If I create a mapping file with various subclasses.
For example,
Class B is a parent of class A, so I made A a subclass of B.
I want to create an object A and type cast it to a B object [(B)A]. If I then pass this B object to the hibernate session to save it to the database will all the fields that object A has, that B does not, be saved to the database?
example:
B is the parent class
B contains the following instance variables and getter/setter methods for each.
firstName
lastName
A is the child class (subclass in hibernate mapping file)
A contains the following instance variables and getter/setter methods for each.
firstName - inherited from B
lastName - inherited from B
middleInitial
Will middleInitial be stored in the database if object A is typecast to object B and passed to a hibernate session?
Thanks!!! :)
|