I'm fairly new to hibernate and use hibernate-tools-3.0alpha1 together with Hibernate 3.0 rc1.
Whenever I try to generate java code from any mapping document the generated code doesn't contain any reference to the id-property that Hibernate seems to need. (When I simply try to run an example it fails, because there are no id-accessor-methods).
After adding
Code:
private Integer id;
private Integer getId() ...
private void setId(Integer id) ...
to the generated POJO the example runs flawless.
For example a mapping-file of mine looks like:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0/EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Test" table="test">
<id name="id" type="int" column="ID">
<generator class="native"/>
</id>
<property name="test" type="string" />
</class>
</hibernate-mapping>
As far as I understand hbm2java should generate code for the id-property, but I didn't find any report in JIRA, so I suppose I'm doing something the wrong way.