Is it possible to do Table Inheritance in Java DB? We have a complex code model that uses inheritance and would also benefit from DB inheritance.
Is it possible? It doesn’t seem possible from a quick google or a poke around in netbeans.
Cheers
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, your question is fairly vague in the details. The more specific you are the better the community can support you. So I’m going to guess what support you are looking for and hope it helps.
If you’re using something like JPA/Hibernate, you can create classes with the annotation
@MappedSuperClass. When the classes are scanned, the relationship between a ‘parent’ table and a child table will be realized. As a quick example:If you’ll notice, the
Fooclass does not have to represent a table. It can just provide some of the common fields that span across a number of tables (typical fields like modified_by, modified_date, etc.). IfBarhas an id like BAR_ID, you can then override the parent with an@AttributeOverrideannotation.While I did everything with annotations, I’m sure you can look into doing this with XML as well.