I get a jndi name from the UI based on which I make a connection and create statement. I have stored the table_name_constant,table name and column_name_constant,column name in a table. Once Connection is obtained i am creating the two maps as below.
table_name_constant - Actual Table Name | column_name_constant - Actual Column Name
I am building my SQL query with key passed into SQL
select map1.get(column_name_constant),... from map2.get(table_name_constant) where map1.get(column_name_constant = ?);
I have done the above design to meet the requirement "Add a new data source, no code changes" but the tables are updated at the database side. It is assumed that the structure of tables will remain same but the table names and column names must be dynamic.
If I have explained properly, Is there any better solution than this?