• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Common DAO layer Code Base - Hibernate Mapping XML changes

 
Harikumar Venkatesan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Anybody can answer this?

Awaiting for the reply

Thanks
Hari.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic