File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Common DAO layer Code Base - Hibernate Mapping XML changes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Common DAO layer Code Base - Hibernate Mapping XML changes" Watch "Common DAO layer Code Base - Hibernate Mapping XML changes" New topic
Author

Common DAO layer Code Base - Hibernate Mapping XML changes

Harikumar Venkatesan
Greenhorn

Joined: Mar 03, 2011
Posts: 13
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

Joined: Mar 03, 2011
Posts: 13
Customer A
------------
HBM file.



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


Java DAO Impl:
----------------
Harikumar Venkatesan
Greenhorn

Joined: Mar 03, 2011
Posts: 13
Anybody can answer this?

Awaiting for the reply

Thanks
Hari.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Common DAO layer Code Base - Hibernate Mapping XML changes