Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate map two classes to same table with each having differnt set of columns.  RSS feed

paddy Mahadeva Iyer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried to look up this issue a lot but was unsuccessful. Let me put my problem through the following case,

I have a Table table1 With Columns column1, clolumn2, column3,......, column12.

In my application I want to create two classes Class1 to Class2 .

In class1 I want to map columns from column1 to column6 and in class2 I want to map columns from column7 to column12. No column will overlap in two classes. When ever I make instance of the model class I will make only of one and the columns in the other class should be accessible from there (Inheritance may be the solution for this).

Is this possible using hibernate?

The idea behind this whole thought process is that there are some core columns that are mandatory for the application and should not be touched. Where as some columns can be modified as part of end user enhancements. I want to keep those columns that are core to the application separate?

Thanks in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!