Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8398175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:58:36+00:00 2026-06-09T20:58:36+00:00

How can I define a many to many relationship in hibernate where the intermediate

  • 0

How can I define a many to many relationship in hibernate where the intermediate table maps to a object? I.e.
Build can have another build as dependency and this dependency can be selected in other builds too. The ‘build dependency’ object should look something like:

BuildDep{
   int id;
   Build parent;
   Build child;
   ....
}

mapping to the intermediate table having columns:

id, child_build_id, parent_build_id

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:58:38+00:00Added an answer on June 9, 2026 at 8:58 pm

    By definition, many-to-many associations can only be used when the association table does not have any other columns besides the foreign keys to the parent tables.

    Instead, you should use two ManyToOne/OneToMany associations.

    Here’s a forum topic on this subject (with an example):

    http://www.coderanch.com/t/218431/ORM/databases/Hibernate-Annotations-many-many-association

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an intermediate table that defines many-to-many relationship between, for instance, Customer and
Many statically typed languages have parametric polymorphism. For example in C# one can define:
I have a many-to-many relationship between 2 tables that I define with a join
I hope I can explain this clearly. I have a table, lets call it
I have two entities with many-to-many relationship defined on them. <set name=TreasuryCodes table=ServiceProviderAccountTreasuryCode lazy=true
i am using hibernate for a application.I have two tables with many-many relationship and
I am trying to define two many to many relationship to same object using
In HTML/CSS you can define a style which can be applied to many types
I can define default value in domain by this way : class ProcessingPriority {
Hibernate complains, Caused by: java.lang.UnsupportedOperationException: Can't write to a readonly object at org.hibernate.cache.ReadOnlyCache.lock(ReadOnlyCache.java:68) for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.