-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Really weird problem
PostPosted: Tue Oct 20, 2009 4:14 am 
Newbie

Joined: Tue Oct 20, 2009 3:46 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: Really weird problem
PostPosted: Tue Oct 20, 2009 4:25 am 
Newbie

Joined: Tue Oct 20, 2009 3:46 am
Posts: 2
I think i found a solution here viewtopic.php?f=1&t=1000394 .
If this solution works, can you use annotation to achieve same thing? any sample code would be appreciated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.