Hi, I face a really weird and complex problem here.
The project i work at, require connecting a java application to a legacy database. For some tables i had successfully implement hibernate tables. It happens that the database, which i think have a really bad design and i am not allowed to change it.
Here's sample database that i am working:
Code:
Table Sample
-------------------
| code | name |
-------------------
| AL | alpha |
| BE | beta |
-------------------
Table alpha
-------------------
| id | numbers |
-------------------
| abc | 5 |
| xyz | 6 |
-------------------
Table beta
--------------------
| id | numbers |
--------------------
| abc | 2 |
| xyz | 7 |
-------------------
Please note that "Sample" table may have a lot of rows with their corresponding table ( currently around 100 rows). Meaning, if in "Sample" table i have 10 rows ("code" columns entry: a,b,c,d,e,f,g,h,i,j) then i would have 10 additional tables with names a,b,c,d,e,f,g,h,i,j.
Also, each tables of those 10 (a,b,c,d,e,f,g,h,i,j) will have same structures, same id for each corresponding rows. They only differ on the other columns.
How do you suggest to solve this problem? Should i gave up using hibernate, and use direct jdbc instead (which i believe will expose some security problem eg. sql injection) .
Thanks.
ps. please forgive my english, i am not native but am trying to improve it