david wrote:
Middlegen has several layers for determining the type thus this can be hard to say what might be the factor.
What version of Middlegen / hibernate plugin are you using?
Can you show a snipit of the hbm and the table ddl?
Thanks for the reply David.
I'm using Middlegen R3 for generation.
Here's an example mapping file
---------------------------------------
VersaoDocumento
Code:
<?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="vo.VersaoDocumento"
table="versao_documento"
>
<composite-id name="comp_id" class="vo.VersaoDocumentoPK">
<key-property
name="id"
column="id"
type="long"
length="8"
/>
<!-- bi-directional many-to-one association to Documento -->
<key-many-to-one
name="documento"
class="vo.Documento"
>
<column name="documento_fk" />
</key-many-to-one>
</composite-id>
<property
name="descricao"
type="java.lang.String"
column="descricao"
length="-1"
/>
<property
name="userSubmissao"
type="java.lang.String"
column="user_submissao"
length="10"
/>
<property
name="dataSubmissao"
type="java.sql.Timestamp"
column="data_submissao"
length="8"
/>
<property
name="aprovado"
type="boolean"
column="aprovado"
length="1"
/>
<property
name="userAprovacao"
type="java.lang.String"
column="user_aprovacao"
length="10"
/>
<property
name="dataAprovacao"
type="java.sql.Date"
column="data_aprovacao"
length="4"
/>
<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 -->
</class>
</hibernate-mapping>
DDL script
-----------------
Code:
CREATE TABLE VERSAO_DOCUMENTO (
id INT8 NOT NULL
, documento_fk INT8 NOT NULL
, descricao TEXT
, user_submissao CHAR(10)
, data_submissao TIMESTAMP(10)
, aprovado BOOLEAN
, user_aprovacao CHAR(10)
, data_aprovacao DATE
, user_id CHAR(10) NOT NULL
, dt_hr TIMESTAMP(10) NOT NULL
, PRIMARY KEY (id, documento_fk)
, CONSTRAINT versao_documento_doc_fk FOREIGN KEY (documento_fk)
REFERENCES DOCUMENTO (id)
);
The PK (id, documento_fk) has two INT8. But after generation,
id will be of type
long and the
id of mapping
Documento which is refrenced by
documento_fk will be of type
Long.
Just curious why the diference...