Friday, August 1, 2008

Database Adapter: Handling Twins

Problem: I had faced this problem in past so thought of sharing this to all. You will encounter a peculiar problem while handling Database schema with the same name containing same table name, for the different systems.

Lets say,
System1:
System name: sys1
Schema name: schema1
Table name: Table1

System2:
System name: sys2
Schema name: schema1
Table name: Table1

Everything will work fine. But problem starts after making the project, i.e. if you want to see the wizard for Database adapter by opening the .esbsvc file, you will become mad to see that the table information is not visible in the window. Actually Jdeveloper automatically deletes descriptor file and some contents from Toplink mappings.

Solutions: After doing some research over this I found out some solutions for handling such types of problem.

Solution1:
1) Create one project against system1 and do the necessary adapter configuration for that database.

2) Now Create again a second project against System2 and do the necessary adapter configuration for that database. (Because the
databases are on different hosts, you use different database connections.)

3) Then create a third project, but do not use the Adapter Configuration Wizard. Instead, copy the BPEL or ESB artifacts (WDSL, XSD, and toplink_mapings.xml) from projects one and two.

4) Only Deploy the third project.

Bingo...It works fine.

Solution2:
This is very lengthy solution. You have to goto the project folder and you have to manually update the .mwp files present under Toplink folder. Also, you need to create descriptor folder containing class descriptor.xml file, under Toplink folder. To do this job, it involves lot of time and manual coding headache.

Actually to crack the problem, solution2 was my first approach. Later on, I found out much easier and better approach i.e. solution1. :)
So, I will personally recommend everybody to use the solution1 technique to get rid of such problem.

Happy learning...

1 comment:

Alina Lisanke said...

Dear Abhishek,

I must admit this comment is not so much in response to this specific post, but I was hoping to get in touch with you and did not know how to contact you directly. The reason for my inquiry is that I am very impressed with the SOA knowledge that you demonstrate in your blog and would like to see if you might be entertaining new career opportunities. We are looking to hire someone with your background at the moment at Innoveer Solutions (www.innoveer.com). If you are interested, please email me at alisanke@innoveer.com or perhaps pass my information along to anyone with background similar to yours who is looking to join a new consulting firm.

Regards,
Alina Lisanke