Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

hibernate "set" element "name" attribute  RSS feed

 
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
Boost this thread!