Hello
My question is regarding the <id> element in the <class> declarion in the mapping file. My understanding from reading the reference manual is that the id name is optional. So I have the following declarion in the mapping file:
Code:
<class "testdb2.Department" table="department">
<id>
<generator class="identity"/>
</id>
...
</class>
The Department java class is the one given in the external documentation example from IBM, minus of course the DepartmentID element.
However, when I run this through the schema generator I get the following error message:
Sep 1, 2003 4:25:02 PM net.sf.hibernate.cfg.Configuration add
SEVERE: Could not compile the mapping document
net.sf.hibernate.MappingException: must specify an identifier type: testdb2.Department
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:218)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1094)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:155)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:285)
(When I reinstate the <id> attributes, then it runs through fine)
Can anyone offer any insight?
thanks!