HI, i have a problem with Hibernate and oracle 11. Here's mi hbm code :
catSucursal
<hibernate-mapping> <class name="bean.CatSucursal" table="CAT_SUCURSAL" schema="POS"> <composite-id name="id" class="bean.CatSucursalId"> <key-property name="idCompania" type="string"> <column name="ID_COMPANIA" length="12" /> </key-property> <key-property name="idSucursal" type="int"> <column name="ID_SUCURSAL" precision="9"/> </key-property> </composite-id> ..... etc <hibernate-mapping>
catEmpleado
<hibernate-mapping> <class name="bean.CatEmpleado" schema="POS" table="CAT_EMPLEADO"> <id name="idEmpleado" type="int"> <column name="ID_EMPLEADO" precision="9" scale="0"/> <generator class="assigned"/> </id> <many-to-one class="bean.CatSucursal" fetch="select" name="catSucursal" > <column name="ID_SUCURSAL" precision="9"/> <column length="12" name="ID_COMPANIA"/> </many-to-one> ....etc <hibernate-mapping>
the problem is, when i get a Empleado via findByExample, send me a Exception :
Fallo al convertir a representación interna
I change the driver, (ojdbc6) by new version, but nothing happens, after 4 hours, it occurred to me change the tags of CatEmpleado.hbm of catSucursal :
BEFORE <many-to-one class="mx.com.pos.bean.CatSucursal" fetch="select" name="catSucursal" > <column name="ID_SUCURSAL" precision="9"/> <column length="12" name="ID_COMPANIA"/> </many-to-one>
AFTER
<many-to-one class="mx.com.pos.bean.CatSucursal" fetch="select" name="catSucursal" > <column length="12" name="ID_COMPANIA"/> <column name="ID_SUCURSAL" precision="9"/> </many-to-one>
Same as the PK of catsucursal, and worked correctly, :( WHY ???
The position of the tags matter ???
After All, this resolved my problem :D
|