Hi,
I´m trying to map a many-to-many relantioship, with the <formula> tag:
<?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="br.com.actumplus.act500.model.faturamento">
<class name="Duplicata" table="FATURA_DUPLICATA">
<composite-id access="field" class="DuplicataID" mapped="false"
name="duplicataID" unsaved-value="undefined">
<key-property column="cod_orgao" name="codigoOrgao" type="java.lang.String"/>
<key-property column="num_ano_fatura" name="numeroAnoFatura" type="java.lang.Integer"/>
<key-property column="num_fatura" name="numeroFatura" type="java.lang.Integer"/>
<key-property column="num_duplic" name="numeroDuplicata" type="java.lang.Integer"/>
</composite-id>
<property column="dat_vencto_duplic" generated="never" lazy="false"
name="dataVencimento" type="java.util.Date"/>
<property column="val_duplic" generated="never" lazy="false"
name="valorDuplicata" type="java.lang.Double"/>
<property column="dat_hora_emissa" generated="never" lazy="false"
name="dataHoraEmissao" type="java.util.Date"/>
<set name="titulosAReceber" inverse="true" table="REL_FATURA_DUP_TITULO_REC">
<key>
<column name="cod_orgao" sql-type="java.lang.String"></column>
<column name="num_ano_fatura"></column>
<column name="num_fatura"></column>
<column name="num_duplic"></column>
</key>
<many-to-many entity-name="br.com.actumplus.act500.model.faturamento.TituloReceber">
<column name="num_ano_recebe"></column>
<column name="num_titulo_recebe"></column>
<formula>cod_orgao</formula>
</many-to-many>
</set>
</class>
</hibernate-mapping>
The cod_orgao is a varchar column. Both sides of many-to-many can be loaded with no problem isolated.
When I try to load the collection I have the error:
org.hibernate.exception.DataException: could not initialize a collection: [br.com.actumplus.act500.model.faturamento.Duplicata.titulosAReceber#component[codigoOrgao,numeroAnoFatura,numeroFatura,numeroDuplicata]{codigoOrgao=ACT, numeroFatura=1, numeroDuplicata=11, numeroAnoFatura=2008}]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:100)
...
caused by:
org.postgresql.util.PSQLException: Valor inválido para tipo int : ACT (ACT is Not an valid int)
and a INFO: 2008-11-18 11:35:54,421 INFO [org.hibernate.type.IntegerType] could not read column value from result set: formula0_1_; Valor inválido para tipo int : ACT
Has someone seen this problem before?
|