System Hibernator 0.9.5 jar file 05/06; Eclipse 2.1.0; WinXP; hibernate 2.0
There appears to be some issues with the generation of *.hbm.xml from source Java files using the Hibernator plug-in.
1) I think the id property is required to be the first tag based on the DTD. It is appearing in the same order as declared in the class.
2) the <param> sub-tag of the <generator> tag for an id has a required property of name that is missing.
Unmodified this was causing NullPointerExceptions in the Hibernator log file view. By correcting these issues, the file now loads in the Hibernator perspective.
Let me know if I am doing something wrong and/or interpeting the DTD incorrectly.
Timothy Vogel
Here is a sample class file and .hbm.xml that demonstrate the issues.
- phone.java -
package businessRules;
public class Phone {
private String countryCode;
private String areaCode;
private String number;
private Person person;
private long id;
public String getCountryCode() {return countryCode;}
public void setCountryCode(String countryCode) {this.countryCode = countryCode;}
public String getAreaCode() {return areaCode;}
public void setAreaCode(String areaCode) {this.areaCode = areaCode;}
public String getNumber() {return number;}
public void setNumber(String number) {this.number = number;}
public Person getPerson() {return person;}
public void setPerson(Person person) {this.person = person;}
public long getId() {return id;}
public void setId(long id) {this.id = id;}
}
System Hibernator 0.9.5 jar file 05/06; Eclipse 2.1.0; WinXP; hibernate 2.0
There appears to be some issues with the generation of *.hbm.xml from source Java files using the Hibernator plug-in.
1) I think the id property is required to be the first tag based on the DTD. It is appearing in the same order as declared in the class.
2) the <param> sub-tag of the <generator> tag for an id has a required property of name that is missing.
Unmodified this was causing NullPointerExceptions in the Hibernator log file view. By correcting these issues, the file now loads in the Hibernator perspective.
Let me know if I am doing something wrong and/or interpeting the DTD incorrectly.
Timothy Vogel
Here is a sample class file and .hbm.xml that demonstrate the issues.
- phone.java -
package businessRules;
public class Phone {
private String countryCode;
private String areaCode;
private String number;
private Person person;
private long id;
public String getCountryCode() {return countryCode;}
public void setCountryCode(String countryCode) {this.countryCode = countryCode;}
public String getAreaCode() {return areaCode;}
public void setAreaCode(String areaCode) {this.areaCode = areaCode;}
public String getNumber() {return number;}
public void setNumber(String number) {this.number = number;}
public Person getPerson() {return person;}
public void setPerson(Person person) {this.person = person;}
public long getId() {return id;}
public void setId(long id) {this.id = id;}
}
- phone.hbm.xml -
<?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="businessRules.Phone" table="phone">
<property name="countryCode"/>
<property name="areaCode"/>
<property name="number"/>
<many-to-one name="person"/>
<id name="id">
<generator class="sequence">
<param>seq_phone</param>
</generator>
</id>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->
Thanks for picking up that one. If you get a chance, then please log a bug report. Either way I will fix it.
Thanks
Daniel