Hi,
I have the following mappings:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="org.scaf.model.FamiliaVO" table="familia">
<id name="numeroInscricao" column="numero_inscricao" type="string">
<generator class="assigned" />
</id>
<property name="endereco" column="endereco" type="string" />
</class>
</hibernate-mapping>
and...
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="org.scaf.model.DesligamentoVO" table="desligamento">
<id name="numeroInscricao" column="numero_inscricao" type="string">
<generator class="assigned" />
</id>
<property name="dataDesligamento" column="data_desligamento" type="date" />
<one-to-one name="familia" class="org.scaf.model.FamiliaVO" constrained="true" />
</class>
</hibernate-mapping>
the DesligamentoVO has a one-to-one association with FamiliaVO, with String primary key...
when I load the DesligamentoVO, I have a ClassCastException..
in the class net.sf.hibernate.type.StringType,
the method
Code:
public void set(PreparedStatement st, Object value, int index) throws SQLException {
st.setString(index, (String) value);
}
receives a Integer paramenter "value", but my primary key is a string then a ClassCast occurs
any idea?
thanks