Hibernate error means the complete opposite of what it says, due to wording error
The following XML:
<one-to-many type="OtherClass"/>
delivers the following error:
Error parsing XML: Attribute "type" must be declared for element type "one-to-many".
This looks like a perfectly self-explanatory error, however looking at the file, the element does have a "type" attribute. What should one do?
At the time I first encountered this, I had only just introduced the "type" attribute. What happens if I change the attribute name to "fsdjkfdk"?
<one-to-many fsdjkfdk="OtherClass"/>
The error is now:
Error parsing XML: Attribute "fsdjkfdk" must be declared for element type "one-to-many".
What the error means is that the attribute must not be declared, as opposed to must.
It's amusing to read even people on the Hibernate team get confused by this error, and can't find a solution.
(Hibernate 3.3.1 – the most current version – although I encountered this error within the first hour of ever using Hibernate in Q1/2006.)