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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:17:48+00:00 2026-05-13T16:17:48+00:00

I want to add elements to a collection that ends up getting mapped like

  • 0

I want to add elements to a collection that ends up getting mapped like this:

<set name="others" inverse="true" lazy="true" table="other" fetch="select">
  <key>
    <column name="otherId" not-null="true" />
  </key>
  <one-to-many class="my.pkg.OtherEntity" />
</set>

I’d like Hibernate to use instead, because I don’t care about the order they’re retrieved in, I just want to keep that side of the association up-to-date. According to https://www.hibernate.org/117.html, “Hibernate can add to a <bag>, <idbag> or <list> declared with inverse=”true” without initializing the collection.”

My problem is I don’t know how to force (or suggest to) the reverse engineering tools (hibernate-tools.jar) to use <bag> or <list>–it ALWAYS uses <set>.

Thanks!

  • 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-13T16:17:48+00:00Added an answer on May 13, 2026 at 4:17 pm

    You can customize the reverse engineering procedure with a reverse-engineering configuration file, which uses an XML syntax. I haven’t tried this myself, but this example may work for you:

    <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE hibernate-reverse-engineering SYSTEM
        "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
    <hibernate-reverse-engineering>
        <table name="MYTABLE">
            <column name="others" type="bag"/>
        </table>
    </hibernate-reverse-engineering>
    

    If it does not work as it is, you may find more details about controlling the reverse engineering process here.

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

Sidebar

Related Questions

I want to write a method that removes all elements from a collection that
When you want to add whitespace between HTML elements (using CSS), to which element
I want to add a property to my User model that returns the number
I want to add same field to multiple tables. Can I do this with
Is it possible to add elements to a collection while iterating over it? More
I want to be able to remove multiple elements from a set while I
Every time that I want to do a Layout, I'm getting a black layout
I want to use a temp directory that will be unique to this build.
I have dbml with single table users i want add partial class for User
I want to add a column to an existing legacy database and write a

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.