Hi!

I had this mapping:
    <class name="VisitaTerceiro" table="visitas_terceiros">
        <composite-id>
            <key-property name="visitaCodigo" column="vis_codigo" />
            <key-many-to-one name="terceiro" column="ter_codigo" 
class="Terceiro" />
            <key-property name="tipo" />
        </composite-id>

        <sql-insert check="none">
        { call prk_crm.store_doc_visita_terceiro (?, ?, ?) }
        </sql-insert>
    </class>

My table have unique key on (vis_codigo, ter_codigo, tipo) and a PK 
(incremented though a sequence) on column codigo. The procedure 
store_doc_visita_terceiro is responsible to fill the PK.

This is used on a set (with one-to-many) in another class. But with this 
mapping, when store_doc_visita_terceiro is called the composite-id 
members are uninitialized.

To make it work, I had to change the mapping using:
    <composite-id name="id" class="VisitaTerceiro$Id">

As you see, this make my class very ugly. Without use a name="id", 
Hibernate considers it a "virtual" property causing the uninitialized 
members. Why this happen? Is there any better solution?

Another problem I had was when I was using <key-many-to-one 
name="visita" column="vis_codigo" class="Visita" /> instead of 
"visitaCodigo". This is the column that links the master table with the 
set. With it, Hibernate enters in infinite recursion and JVM just dies. 
Is it a Hibernate bug?

I'm using Hibernate 3.3.

Thanks,


Adriano



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to