Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why Index element require in List and one to many mapping

 
Shankar sanjay
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am new to Hibernate, i found something strange in mapping XML file.
In Net Beans 6.5.1, i have done mapping, it shows XML is invalid, the system force to add index column element.

Invalid XML:
---------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.Bank" table="Bank" >
<id name="BankCode" column="BankCode" type="long">
<generator class="increment"/>
</id>

<list name="BankBranches" cascade="all">
<key column="BankID"> </key> ---problem here, system is expecting index element
<one-to-many class="com.Branches"/>
</list>


<property name="BankName" column="BankName"/>
</class>
</hibernate-mapping>

Valid xml :
------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.Bank" table="Bank" >
<id name="BankCode" column="BankCode" type="long">
<generator class="increment"/>
</id>
<list name="BankBranches" cascade="all">
<key column="BankID"> </key>
<index column="indx"/>
<one-to-many class="com.Branches"/>
</list>
<property name="BankName" column="BankName"/>
</class>
</hibernate-mapping>

Could you please any one tell that what is the purpose of "<index column="indx"/>", without that how can i proceed?

Regards,

Sankar. S
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this perhaps a requirement due to the generator?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic