I want to create a data model for my new application but I don't want to bind my application directly to any ORM framework such as Jpa. I don't want any Jpa-things in my underlying model. I want to "append" them.
So my first approach for the model looks like this:
And if I want to use this with Jpa now, this would be nice:
But I get some problems using this solution. For example I get the following exception:
I know, I can make some workarounds by creating a new instance of JpaFoo and setting all its values to the values of super.getFoo(). But I want to know if this is the common way for this problem or if I am completely wrong with my ideas.
Thanks in advance
posted 8 years ago
Sounds to me as if you want to create something similar to the DAO pattern from J2EE.
I think you should not inherit your JPA classes from your base classes, but create an interface and implement this interface in both classes. And you should write your code against the interfaces, not the classes.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads