0

There is a table_a which has primary key Id which is referenced to Table_b as foreign key and i want to create another table_c which foreign key reference should be a column of Table_b. While i created the table somehow and wanted to create a Persistence class via JPA Eclipse wizard. But i am failed to do so, any idea ?

Table_A
id int not null primary,----------------------------
name varchar(20)                                   | 
                                                   |
Table_B
id int not null,                                   | 
a_id int not null,                                 |
dept varchar(20),
Primary Key(id),                                   | 
Foreigns key(a_id) References Table_A (id)-------->|

                                                   | 
Table_C                                            |
id int not null,
c_id int not null,                                 | 
desc varchar(25),
Primary Key (id),                                  |
Foreigns key (c_id) References Table_B (a_id)----->|

I have doubt over SQL creating of table_c but i have received the DB design document in which mention as above, can anybody help me please.

mabi
  • 5,279
  • 2
  • 43
  • 78
user1010399
  • 2,258
  • 5
  • 30
  • 42
  • What's your "failure" with JPA Eclipse Wizard? Did it crash? Did it produce an incorrect result? – mabi Dec 17 '13 at 09:57
  • It failures and i don't see any column under table in eclipse wizard at `customized individual entities ` screen and it doesn't produce any class – user1010399 Dec 17 '13 at 11:08
  • I've never used this Wizard, but you're saying you "have doubts over SQL creating table_c" - do you mean you don't know whether the table really exists? – mabi Dec 17 '13 at 11:24
  • @mabi, no. i have to create a table_c which does not exists and then create a persistence class of it, as i am using eclipse Jpa wizard. My doubt on creating the `FK` in table_c and giving `reference` to Table_b (a_id). where `a_id` column is also FK in Table_b. – user1010399 Dec 17 '13 at 12:28
  • So what happens if you let c_id reference `Table_B.id` instead? Is your wizard able to generate code for that? – mabi Dec 17 '13 at 12:38
  • oh ok... i haven't checked that. i'll do that now and let you know the result. – user1010399 Dec 17 '13 at 13:00

0 Answers0