Hi team, I am new to Hibernate so please execuse my ignorance. I read so many articles about inheritance but couldn't find a clear answer to the following question.
For using SINGLE_TABLE inheritancer strategy I have to have a special field (DTYPE) in my table to store the class type, is this correct? This sounds like changing a DB design to serve an ORM requirements?
If this is so, say I have one table called MEMO and two classes; MemoHeader which is extended by another class MemoDetails which extends MemoHeader. All my Memo information are saved using instances of MemoDetails. I guess using the SINGLE_TABLE strategy will insert a value - say "details" - in the discriminator column, so: Q 1- If I want to get a List<MemoHeader> object from my MEMO table will I be able to do that when all the records were saved using MemoDetails entity class, or Hibernate will understand how to get back those records typed "details" but wraps them up as MemoHeader objects?
Q 2- Will it still work the other way around? I mean, save MemoHeader as "header" and get it back as a List<MemoDetails>?
Thanks for any clarification.
Daniel,
|