Hibernate Version 3.2.4.sp1:
I tried to build POJOs with hbm2java of hibernate tools. It works perfect except in the following situation
Case 1) Works OK
<?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 package="com.test.web">
<class name="Test100" table="test100">
<id name="testId" column="testId" type="integer">
<generator class="native"></generator>
</id>
<property name="middleName" column="middleName" type="string" unique="true" ></property>
</class>
</hibernate-mapping>
package com.test.web;
// Generated Dec 4, 2008 8:50:04 PM by Hibernate Tools 3.2.0.b9
/**
* Test100 generated by hbm2java
*/
public class Test100 implements java.io.Serializable {
private Integer testId;
private String middleName;
public Test100() {
}
public Test100(String middleName) {
this.middleName = middleName;
}
public Integer getTestId() {
return this.testId;
}
public void setTestId(Integer testId) {
this.testId = testId;
}
public String getMiddleName() {
return this.middleName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
}
Works ok.
Now case 2 )
Now I added <properties > ........ </properties>.
<?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 package="com.test.web">
<class name="Test100" table="test100">
<id name="testId" column="testId" type="integer">
<generator class="native"></generator>
</id>
<properties name="testUnique" unique="true" update="false"> <property name="firstName" column="firstName" type="string"></property> <property name="lastName" column="lastName" type="string"></property> </properties>
<property name="middleName" column="middleName" type="string" unique="true" ></property>
</class>
</hibernate-mapping>
package com.test.web;
// Generated Dec 4, 2008 8:53:43 PM by Hibernate Tools 3.2.0.b9
/**
* Test100 generated by hbm2java
*/
public class Test100 implements java.io.Serializable {
private String firstName;
private String lastName;
public Test100() {
}
public Test100(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
In this case, it does not add properties testId, and middleName in generated POJO. Did I made any mistake or it is bug
|