Hibernate version:
Upgrading
from:hibernate-2.1.6 to:hibernate-3.0.2
Using HibernateTools-3.1.0.beta4
Problem
hbm2java creates a default constructor and a full constructor but they are both default constructors.
OrderType.hbm.xml:
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="OrderType">
<id name="orderType" type="string">
<generator class="native"/>
</id>
</class>
<sql-query name="queryByOrderId">
<return alias="ot" class="OrderType"/>
select
'Install' as {ot.orderType}
from
... co
where
...
and co.ORDER_ID=:orderId
</sql-query>
</hibernate-mapping>
Ant build.xml:
Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="classpath"/>
<target name="codegen" depends="init" description="Generate classes">
<hibernatetool destdir="${src.dir}">
<configuration propertyfile="hibernate.properties">
<fileset id="hibernate.mapping.files" dir="${src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>
</target>
Generated Pojo:
Code:
/**
* OrderType generated by hbm2java
*/
public class OrderType implements java.io.Serializable {
// Fields
private String orderType;
// Constructors
/** default constructor */
public OrderType() {
}
/** full constructor */
public OrderType() {
}
// Property accessors
public String getOrderType() {
return this.orderType;
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
}
Any ideas? THX.