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!
Ever you would have List-type instead of Set-type you may use ant-java-task using:
Using the class "de.wedeaf.beans.BeanHelper":
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:
If it does not work as it is, you may find more details about controlling the reverse engineering process here.