david wrote:
From wht you are saying hbm2java is not correct so its not a Middlegen issue as such. How about you provide small snipit of code fragments so we can verify if this is issue. Thanks.
---------
Tools:
---------
Hibernate 2.0.3
Middlegen R3
hibernate-extensions 2.0
----------------------------------------
Mapping file (generated with R3):
----------------------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="pt.ArmazemMp"
table="armazem_mp"
>
<id
name="mpLoteFk"
type="long"
column="mp_lote_fk"
>
<generator class="increment" />
</id>
<property
name="localizacao"
type="java.lang.String"
column="localizacao"
length="10"
/>
<property
name="userId"
type="java.lang.String"
column="user_id"
not-null="true"
length="10"
/>
<property
name="dtHr"
type="java.sql.Timestamp"
column="dt_hr"
not-null="true"
length="8"
/>
<!-- associations -->
<!-- bi-directional one-to-one association to MpLote -->
<one-to-one
name="mpLote"
class="pt.MpLote"
outer-join="auto"
/>
</class>
</hibernate-mapping>
-----------------------------------------------
Java classe (generated with hbm2java):
-----------------------------------------------
package pt;
import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/** @author Hibernate CodeGenerator */
public class ArmazemMp implements Serializable {
/** identifier field */
private Long mpLoteFk;
/** nullable persistent field */
private String localizacao;
/** persistent field */
private String userId;
/** persistent field */
private java.util.Date dtHr;
/** nullable persistent field */
private pt.comseal.arsol.vo.MpLote mpLote;
/** full constructor */
public ArmazemMp(java.lang.String localizacao, java.lang.String userId, java.util.Date dtHr, pt.comseal.arsol.vo.MpLote mpLote) {
this.localizacao = localizacao;
this.userId = userId;
this.dtHr = dtHr;
this.mpLote = mpLote;
}
/** default constructor */
public ArmazemMp() {
}
/** minimal constructor */
public ArmazemMp(java.lang.String userId, java.util.Date dtHr) {
this.userId = userId;
this.dtHr = dtHr;
}
public java.lang.Long getMpLoteFk() {
return this.mpLoteFk;
}
public void setMpLoteFk(java.lang.Long mpLoteFk) {
this.mpLoteFk = mpLoteFk;
}
public java.lang.String getLocalizacao() {
return this.localizacao;
}
public void setLocalizacao(java.lang.String localizacao) {
this.localizacao = localizacao;
}
public java.lang.String getUserId() {
return this.userId;
}
public void setUserId(java.lang.String userId) {
this.userId = userId;
}
public java.util.Date getDtHr() {
return this.dtHr;
}
public void setDtHr(java.util.Date dtHr) {
this.dtHr = dtHr;
}
public pt.comseal.arsol.vo.MpLote getMpLote() {
return this.mpLote;
}
public void setMpLote(pt.comseal.arsol.vo.MpLote mpLote) {
this.mpLote = mpLote;
}
( ... )
}
----------------
Conclusions:
----------------
As you can see, the property "dtHr" is type "java.sql.Timestamp" in the mapping file and in the class it has type "java.util.Date".