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 7091953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:15:08+00:00 2026-05-28T08:15:08+00:00

I m using one-to-many mapping for List using join table. There are lot of

  • 0

I m using one-to-many mapping for List using join table.
There are lot of examples available on net of this mapping using Sets but not with Lists.

Consider tables:

Table Ticket
{
ticketid int PK;
...
}

Table Attachment
{
attachmentid int PK;
...
}

Join Table:

Ticket_Attachment_Join
{
tid  FK (ref to Ticket.ticketid)
aid PK FK(ref to Attachment.attachmentid)
}

Mappings:
Ticket.hbm.xml:

    <hibernate-mapping>
    <class name="Tickets" table="Ticket">
    ...
    <list name="attachmentsList" table="Ticket_Attachment_Join" cascade="save-update">
            <key column="ticketid"/>
           <list-index column="index_col"/>
            <many-to-many column="attachmentId" unique="true" class="Attachments" />
    </list>

...
</class>
</hibernate-mapping>

I want to ask that in which table i should put column index_col (<list-index...>column)? In Attachment table or in join table?? Is it neccessary to put index_col for lists in the table which represents lists(Here ‘Attachment’ table).

  • 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-05-28T08:15:08+00:00Added an answer on May 28, 2026 at 8:15 am

    It should be on Ticket_Attachment_Join as it is the table you are refering to in list mapping.

     <list name="attachmentsList" table="Ticket_Attachment_Join" 
                                          cascade="save-update">
    

    And if you don’t need any indexed collections you can map that attachmentsList using <bag> then you don’t need that <list-index column="index_col"/> mapping at all.

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

Sidebar

Related Questions

There are many ways of doing debugging, using a debugger is one, but the
I can set up one-to-many mapping of List objects by using annotations, however using
I am trying to implement a one-to-many relationship using NHibernate 2.1.2 but keep getting
i am trying to persist two entities(with one to many relationship) using jpa but
I've got several function where I need to do a one-to-many join, using count(),
Hi I'm trying to map a one-many parent-child relationship in NHibernate using XML mapping.
i have one problem in one-to-many mapping using hibernate. i have 2 classes, Person
I've run into a problem when using a one to many relationship. I want
Here is my layout, Summary view http://img689.imageshack.us/img689/2500/yuidtsum.jpg I am using one div and many
When using generateModelsFromDb to generate the models Doctrine makes one to many relations between

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.