Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Hibernate Table dividing Problem

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
What's that smell? I think this tiny ad may have stepped in something.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic