The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

davidarnone (1) [Avatar] Offline
#1
We have a design which contains a common "info" object that is used at two different levels of aggregation. At one level the data it maps to is dynamic and is a view table (it is not possible to build a consistent physical table) and at another level of aggregation the object maps to a different physical table. Because a POJO can only be mapped to one DB table we have solved the problem by deriving two separate classes off of the "info" class. Both of these subclasses do not extend the base class in any way and are only derived so one can be mapped to the view and the other to the physical table. I consider this bad object design and we are only forced to do this because of Hibernate constrains.

My question is do we have the right solution? Is there a more elegant way of solving this problem?

Regards,
Dave Arnone