-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: insert error
PostPosted: Fri Jun 08, 2007 8:21 am 
Newbie

Joined: Fri Jun 08, 2007 8:07 am
Posts: 4
I have the next mappings:

-------------------------------------------------------------------
<class name="es.telefonica.RP.entidades.Oportunidad"
table="Oportunidades" lazy="true" where="fechaEliminacion is null">

<id name="id" type="long">
<column name="id"/>
<generator class="native">
<param name="sequence">Oportunidades_id_seq</param>
</generator>
</id>

<set name="numeroProductosOportunidad" cascade="save-update" lazy="true" inverse="true">
<key column="id_oportunidad" foreign-key="fk_oportunidad_num"/>
<one-to-many class="es.telefonica.RP.entidades.NumeroProductosOportunidad"/>
</set>

</class>
</hibernate-mapping>
-------------------------------------------------------------------

<class name="es.telefonica.RP.entidades.NumeroProductosOportunidad"
table="Numeros_prod_oport" lazy="true" where="fecha_eliminacion is null">

<id name="id" type="long">
<column name="id"/>
<generator class="native">
<param name="sequence">Numeros_Prod_Oport_id_seq</param>
</generator>
</id>
<many-to-one name="oportunidad" insert="true" update="true" class="es.telefonica.RP.entidades.Oportunidad" column="id_oportunidad"/>
</class>
</hibernate-mapping>
--------------------------------------------------------------------
I do:

oportunidadDao.salve(o);

and result:

Hibernate: select Oportunidades_id_seq.nextval from dual

Hibernate: select Numeros_Prod_Oport_id_seq.nextval from dual

Hibernate: insert into Oportunidades (creation_date, fecha_eliminacion, fecha_estimada, fecha_proxima_visita, fecha_visita, numeroViviendas, observaciones, probabilidad, tipo, id_promotorRP, id_vendedor, id_prmocion, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Hibernate: insert into Numeros_prod_oport (cantidad, creation_date, fecha_eliminacion, id_catalogo_producto, id_oportunidad, id) values (?, ?, ?, ?, ?, ?)

Hibernate: update Numeros_prod_oport set cantidad=?, creation_date=?, fecha_eliminacion=?, id_catalogo_producto=?, id_oportunidad=? where id=?

08/06/2007 14:15:29 WARN - SQL Error: 2291, SQLState: 23000
08/06/2007 14:15:29 ERROR - ORA-02291: restricción de integridad (ADEMANDA_OWNER.FK_OPORTUNIDAD_NUM) violada - clave principal no encontrada

Why?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.