Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I have a domain model with a lot of inheritance. Do I have to model my inheritance in TopLink?

0
Posted

I have a domain model with a lot of inheritance. Do I have to model my inheritance in TopLink?

0

No. Inheritance in TopLink only needs to be modeled relationally if you plan to query or write the super classes. Consider the example where class A has a subclass called B. A has two attributes: id and description. On the database, there is both an ID and DESCRIPTION field on B’s table, but A has no table associated with it. All you need to do is map B; you can ignore its superclass A. The fields contained in A can be mapped through mapping B. This allows you to map an object model but ignore certain classes that shouldn’t logically be persisted (e.g. abstract classes, “PersistentObject” superclasses, etc.).

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.