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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:59:10+00:00 2026-05-18T19:59:10+00:00

I was using a Set but now due to a widget restriction, I need

  • 0

I was using a Set but now due to a widget restriction, I need to use a list.a
a sample of my mapping file using A SET and a List are as follows. Can someone help me to place the list index. I am getting some confusion.

**Attribute Mapping File using Set**
?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 16, 2010 5:25:09 AM by Hibernate Tools 3.4.0.Beta1 -->
<hibernate-mapping>
    <class name="h.Attribute" table="ATTRIBUTE">
        <id name="AttributeId" type="long">
            <column name="ATTRIBUTEID" />
            <generator class="native" />
        </id>
        <property name="AttributeName" type="java.lang.String">
            <column name="ATTRIBUTENAME" />
        </property>
        <set name="Options" table="ATTRIBUTEOPTION" inverse="false"  cascade="all" lazy="true">
            <key>
                <column name="ATTRIBUTEID" />
            </key>
            <one-to-many class="h.AttributeOption" />
        </set>
    </class>
</hibernate-mapping>



 **Category Mapping File using Set**
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 16, 2010 8:37:02 AM by Hibernate Tools 3.4.0.Beta1 -->
<hibernate-mapping>
    <class name="h.Category" table="CATEGORY">
        <id name="CategoryId" type="long">
            <column name="CATEGORYID" />
            <generator class="native" />
        </id>
        <property name="CategoryName" type="java.lang.String">
            <column name="CATEGORYNAME" />
        </property>

        <many-to-one name="ParentCategory" class="h.Category">
            <column name="PARENT_CATEGORY_ID" />
        </many-to-one>

        <set name="SubCategory" lazy="true" cascade="all-delete-orphan" inverse="true">
            <key>
                <column name="PARENT_CATEGORY_ID" />
            </key>
            <one-to-many class="h.Category" />
        </set>

        <set name="AllAttributes" table="ATTRIBUTE" inverse="false" lazy="true"  cascade="all">
            <key>
                <column name="CATEGORYID" />
            </key>
            <one-to-many class="h.Attribute" />
        </set>

    </class>
</hibernate-mapping>

Category Mapping File using list without the list index

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 17, 2010 2:10:50 AM by Hibernate Tools 3.4.0.Beta1 -->
<hibernate-mapping>
    <class name="h.Category" table="CATEGORY">
        <id name="CategoryId" type="long">
            <column name="CATEGORYID" />
            <generator class="assigned" />
        </id>
        <property name="CategoryName" type="java.lang.String">
            <column name="CATEGORYNAME" />
        </property>
        <many-to-one name="ParentCategory" class="h.Category" fetch="join">
            <column name="PARENTCATEGORY" />
        </many-to-one>
        <list name="SubCategory" inverse="false" table="CATEGORY" lazy="true">
            <key>
                <column name="CATEGORYID" />
            </key>
            <list-index></list-index>
            <one-to-many class="h.Category" />
        </list>
        <list name="AllAttributes" inverse="false" table="ATTRIBUTE" lazy="true"  cascade="all">
            <key>
                <column name="CATEGORYID" />
            </key>
            <list-index></list-index>
            <one-to-many class="h.Attribute" />
        </list>
    </class>
</hibernate-mapping>

Attribute Mapping File using list with not list index

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 17, 2010 2:10:50 AM by Hibernate Tools 3.4.0.Beta1 -->
<hibernate-mapping>
    <class name="h.Attribute" table="ATTRIBUTE">
        <id name="AttributeId" type="long">
            <column name="ATTRIBUTEID" />
            <generator class="assigned" />
        </id>
        <property name="AttributeName" type="java.lang.String">
            <column name="ATTRIBUTENAME" />
        </property>
        <list name="Options" inverse="false" table="ATTRIBUTEOPTION" lazy="true" cascade="all">
            <key>
                <column name="ATTRIBUTEID" />
            </key>
            <list-index></list-index>
            <one-to-many class="h.AttributeOption" />
        </list>
    </class>
</hibernate-mapping>
  • 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-18T19:59:10+00:00Added an answer on May 18, 2026 at 7:59 pm

    Read Hibernate Reference: 6.2.3. Indexed collections

    For Example:

        <list name="whatEver">
            <key column="whatEver_fk"/>
            <index column="idx"/>
            <one-to-many class="WhatEver"/>
        </list>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was using a Set but now due to a widget restriction, I need
I grew up learning to set up data structures using OOP. But now as
Simple question, but I haven't found a good explanation on google. When using Set
I'm using Eclipse's AntRunner to build a set of plugins, but I'm having trouble
I just set up my new homepage at http://ritter.vg . I'm using jQuery, but
I want to log onto Stack Overflow using OpenID, but I thought I'd set
I am using a set because, i want to use the quick look up
I've been successfully using CakePHP's email component to send my email but due to
I am using tutorial (now inaccessible) UITableView - Searching table view. but I really
I set up an Entity using the Xcode .xcdatamodel file editor. I created an

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.