Hibernator produces key mapping for POJO object such as:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="Cat" table="cat">
<id name="id">
<generator class="sequence">
<param>seq_cat</param>
</generator>
</id>
<property name="name"/>
<property name="sex"/>
<property name="weight"/>
</class>
</hibernate-mapping>
<!-- parsed in 23ms -->
This always gives an error:
10:24:58,600 ERROR XMLHelper:48 - Error parsing XML:
Cat.hbm.xml(10) Attribute "name" is required and must
be specified for element type "param".
10:24:59,004 INFO Binder:220 - Mapping class: Cat -> cat
10:24:59,420 ERROR Configuration:172 - Could not
configure datastore from file: Cat.hbm.xml
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:391)
....etc....
What is needed is a mapping like the following that I
took from the Hibernate quick start guide:
<!-- A 32 hex character is our surrogate key. It's
automatically
generated by Hibernate with the UUID
pattern. -->
<id name="id" type="string" unsaved-value="null" >
<column name="CAT_ID" sql-type="char(32)"
not-null="true"/>
<generator class="uuid.hex"/>
</id>
If I run the mapping above with the SchemaExport
utility, the schema is created. However there is
still a problem. Hibernator keeps complaining that the
mapping on the file system is out of synch with the
mapping in Hibernator. I can then save the generated
mapping, and it will work, but only after first
creating the schema with the manually modified mapping.
Using: Eclipse 2.1.2
Red Hat Linux 7.0
Hibernator .92
Postgres 7.3.4
paul_kneeland@sbcglobal.net