• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Parent-Child Relationship Problem

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
grapes are vegan food pellets. Eat this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic