Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Common DAO layer Code Base - Hibernate Mapping XML changes

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm working on Critical part of Hibernate design changes.

Here is the main goal to achieve:-
-Common Code base which means Struts2.0/Hibernate integration.
-Records are almost same which are in the different tables but data model is different.

Explanation:

I need to develop the Common DAOImpl layer in which any of the tables which has common records irrespective of any of the data model,UI screen will have to work accordingly.

Two Tables like
1)Customer A
2) Customer B

Customer A has different relational mappings with the Primary and foreign Key relationships.

Customer B has flat table.But both the tables are located in the same database and records are also are one in the same.

Primary key for Customer A would be Cust_Agn and Customer B would be CUST_ID.

I have developed the code using Struts2/Hibernate in such a way that by passing the Cust_agn and returning CUSTOMER A object get all the relationship records and displayed in the UI.

If I want to use the same method to get the Customer B records how this can be achieved.Please help or suggest me the right way to do this.

Is there any logic in which no code changes only HBM mapping file changes to display the records in Customer B.



If anyone has incorporated this scenario please post the reply,which was really challenging to me.

PS:I know that HBM mapping file will be closely related the Value objects which are generated from Database was table specific.

Thanks,
Hari.




 
Harikumar Venkatesan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Customer A
------------
HBM file.



Customer B HBM file
---------------------------


Java DAO Impl:
----------------
 
Harikumar Venkatesan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anybody can answer this?

Awaiting for the reply

Thanks
Hari.
 
reply
    Bookmark Topic Watch Topic
  • New Topic