-->
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: One to One Mapping with Foriegn Key
PostPosted: Tue Jul 27, 2004 1:32 pm 
Newbie

Joined: Tue Jul 27, 2004 1:28 pm
Posts: 5
Hi
I am hIbernate beginnner and read the document about Parent Child before posting this message. I have a table A with unique Id (sequence). I have table B with a unique Id(Sequence) and foriegn key, which is table A's ID. I am trying to insert the data into both the tables and I am getting
"java.sql.SQLException: ORA-02291: integrity constraint (BLQ.FK1_LOOP_QUERY_REQUEST) violated - parent key not found" error. This is hbm.xml looks like


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!--
Document : QualiFicationRequest.hbm.xml
Created on : July 26 2004
Author : Nandhu
Description:
This is a Hibernate Object Relational Mapping document
that relates the Qualification Request Class to QUALIFICATION_REQUEST table.
-->
<hibernate-mapping>
<!-- Profide fully qualified class name for this tag -->
<class name="com.birch.vitria.blq.persistentobjects.QualificationRequest" table="BLQ.QUALIFICATION_REQUEST">
<!-- Primary key assignment -->
<id name="qualificationRequestId">
<column name="QUALIFICATION_REQUEST_ID" sql-type="Number(30)" not-null="true"/>
<generator class="sequence">
<param name="sequence">BLQ.SEQ_QUALIFICATION_REQUEST</param>
</generator>
</id>
<!-- Map the attributes of the class to columns of table -->
<property name="userName">
<column name="CREATE_BY" sql-type="VARCHAR2(30)" not-null="true"/>
</property>
<property name="createDate">
<column name="CREATE_DATE" sql-type="DATE(7)" not-null="true"/>
</property>
<property name="modUserName">
<column name="LAST_MOD_BY" sql-type="VARCHAR2(30)" not-null="false"/>
</property>
<property name="modifiedDate">
<column name="LAST_MOD_DATE" sql-type="DATE(7)" not-null="false"/>
</property>
<property name="statusTypeId">
<column name="STATUS_TYPE_ID" sql-type="NUMBER(10)" not-null="true"/>
</property>
<property name="listName">
<column name="LIST_NAME" sql-type="VARCHAR2(100)" not-null="true"/>
</property>
<!-- <set name="forward" lazy="true" inverse="true">
<key column="QUALIFICATION_REQUEST_ID"/>

<one-to-many class="com.birch.vitria.blq.persistentobjects.LoopQueryRequest"/>
</set>-->

<one-to-one constrained="true" name="forward" class="com.birch.vitria.blq.persistentobjects.LoopQueryRequest" property-ref="reverse">
</one-to-one>
</class>
<class table="BLQ.LOOP_QUERY_REQUEST" dynamic-insert="false" name="com.birch.vitria.blq.persistentobjects.LoopQueryRequest" lazy="false">
<id name="loopQueryRequestId">
<column name="LOOP_QUERY_REQUEST_ID" sql-type="Number(30)" not-null="true"/>
<generator class="sequence">
<param name="sequence">BLQ.SEQ_LOOP_QUERY_REQUEST</param>
</generator>
</id>
<property name="fileName">
<column name="FILE_NAME" sql-type="VARCHAR2(100)" not-null="true"/>
</property>
<property name="userName">
<column name="CREATE_BY" sql-type="VARCHAR2(30)" not-null="true"/>
</property>
<property name="createDate">
<column name="CREATE_DATE" sql-type="DATE(7)" not-null="true"/>
</property>

<!-- <property name="qualificationRequestId">
<column name="QUALIFICATION_REQUEST_ID" sql-type="NUMBER(30)" not-null="true" unique-key="BLQ.FK1_QUALIFICATION_REQUEST"/>
</property>-->

<!--<one-to-one cascade="all" name="reverse" constrained="true" class="com.birch.vitria.blq.persistentobjects.QualificationRequest" foreign-key="BLQ.FK1_QUALIFICATION_REQUEST" >
</one-to-one>-->
<many-to-one name="reverse" class="com.birch.vitria.blq.persistentobjects.QualificationRequest"
column="QUALIFICATION_REQUEST_ID" not-null="true" unique="true"/>

</class>



</hibernate-mapping>


Any ideas where I am making a mistake?


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.