aspose file tools
The moose likes Object Relational Mapping and the fly likes Hibernate Table dividing Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate Table dividing Problem" Watch "Hibernate Table dividing Problem" New topic
Author

Hibernate Table dividing Problem

aditya parvatam
Greenhorn

Joined: Jul 10, 2007
Posts: 6
Hi,
I have an issue raised due to the splitting of a table into two

Present Scenario:-I have a table mapped to an Hibernate hbm file and a class

New Requrement:-Due to some reasons the database team divided the table into two new tables with some common columns but with same primary key.So ideal case ie we need to write two new HBM files mapped to two new POJO classes.But if we do this we need to change a number of classes .
Is there any new way so that the same old class is used with the new requirement resulting in less number of changes in the code


Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
If you haven't divided UI also into two, What I would suggest keep the same JavaBean(now you can say DTO) to map with your UI. But you have to have two Java Beans for two tables. Write one Service method to populate those beans and persist them.

Does this sound good?
aditya parvatam
Greenhorn

Joined: Jul 10, 2007
Posts: 6
The UI or java bean is not my problem
My problem is can i map the old HBM file to newly splitted two tables or is there any technique in hibernate so that the same old mapped class (Before splitting) is used to map the new requirement also
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Hibernate Table dividing Problem
 
Similar Threads
complex query in hibernate
Hibernate annotation: exclude a field
Reg : two hbm file for one java class...........
Mapping same POJO to more than one table in Hibernate XML mapping files
Help with HQL