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

hibernate "set" element "name" attribute

 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The documentation says I can use the name attribute in a set, but when using the DTD provided, my xml parser doesn't allow me to make a set like this:

<set name="kittens">
<key column="mother_id"/>
<one-to-many class="Cat"/>
</set>

it says "set" needs an attribute called "role"

but the documentation http://www.hibernate.org/hib_docs/reference/en/html_single/#mapping-declaration

has this example:
<class name="Cat" table="CATS" discriminator-value="C">
<id name="id" column="uid" type="long">
<generator class="hilo"/>
</id>
<discriminator column="subclass" type="character"/>
<property name="birthdate" type="date"/>
<property name="color" not-null="true"/>
<property name="sex" not-null="true" update="false"/>
<property name="weight"/>
<many-to-one name="mate" column="mate_id"/>
<set name="kittens">
<key column="mother_id"/>
<one-to-many class="Cat"/>
</set>
<subclass name="DomesticCat" discriminator-value="D">
<property name="name" type="string"/>
</subclass>
</class>

is the documentation wrong or am I following an old DTD?
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I was using the wrong DOCTYPE tag. The correct Doctype, as it says clearly in the documentation, is:

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic