• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parent-Child Relationship Problem

 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am a newbie to Hibernate. I am working on one-to-many relationship in hibernate.

I am having 2 tables. Course & Enquiry tables.

Course ===> Parent Table(M_COM_ENQRY_COURSE)
Enquiry====> Child Table(M_COM_ENQRY_FORM)

Parent Table:- M_COM_ENQRY_COURSE

CRSENQRY_N_ID
CRSENQRY_VC_CRSNM
CRSENQRY_C_STS


This table is reference by child table.

Child TAble:- M_COM_ENQRY_FORM

ENQFORM_N_ID
ENQFORM_VC_NM
ENQFORM_CRSENQRY_N_ID refers CRSENQRY_N_ID in parent table


and more columns are there but not required.


This is the design.

According to that my hibernate mapping files are:











POJO Class code:









Note:- M_COM_ENQRY_COURSE already consists of data..Acutally, M_COM_ENQRY_COURSE is the master table.

Requirement:-- I don't want to insert into that M_COM_ENQRY_COURSE(parent) table. I want to insert into only M_COM_ENQRY_FORM(child) table...

while inserting into child , just refer to parent table whether the data is existing or not..

Doubt:-- According to my requirement, is this my configuration is correct (or) not?


According to your response, i'll come up with my other Exception in this scenario..

Please anybody help..

Thanks
Vipul Kumar.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic