This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How can I insert value in another table

Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having three tables:

USER-TABLE: Here USER-ID is the primary key.

PROJECT-DETAIL-TABLE: Here PROJECT-ID is the primary key.

PROJECT-REL-TABLE: Here USER-ID and PROJECT-ID is the composite key.

PROJECT-REL-TABLE is the relationship table between USER-TABLE and PROJECT-DETAIL-TABLE.

I have made an application with Spring and hibernate where I am inserting the data in PROJECT-DETAIL-TABLE.

USER-TABLE already has the data which includes USER-ID. Now I want to insert the USER-ID and PROJECT-ID to PROJECT-REL-TABLE.

How can I achieve this using Hibernate.

Please help me out. Its very urgent.

Posts: 4107
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Its very urgent.

Please read -> EaseUp.

In general a many-to-many relationship is implemented through two one-to-many relationships from the related entities. So your Project detail entity and User entity will have to model in that way. An example here
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic