db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tak Fujimoto <t-fujim...@beingcorp.co.jp>
Subject insert data into a table with foreign key
Date Wed, 16 Apr 2003 04:07:36 GMT
I have encountered a strange behavior on torque.

I am unable insert data into a table which has two foreign references.


This is the part of project-schema.xml which describes the table I am having a trouble with.
*****************************************************************************************
<table name="TELSUPPORT">
  <column name="TELSUPPORT_ID"  type="INTEGER"  required="true" autoIncrement="true"
    primaryKey="true" />
  <column name="MEMBER_ID"      type="INTEGER"  required="true"  />
  <column name="DATE"    type="DATE"  default="now" required="true"  />
  <column name="TIME"    type="TIME" default="now" required="true"  />
  <column name="CUSTOMER_NUM"      type="INTEGER"  default="0" />
  <column name="INQUIRY_ID"      type="INTEGER"  required="true" />
  <column name="SUPPORTRESULT_ID"     type="CHAR" size="1"  required="true" />
  <column name="TELSUPPORT"      type="VARCHAR" size="10000" default="" />
    <foreign-key foreignTable="MEMBER">
      <reference local="MEMBER_ID" foreign="MEMBER_ID" /></foreign-key>
    <foreign-key foreignTable="INQUIRY">
      <reference local="INQUIRY_ID" foreign="INQUIRY_ID" /></foreign-key>
    <foreign-key foreignTable="SUPPORTRESULT">
      <reference local="SUPPORTRESULT_ID"foreign="SUPPORTRESULT_ID" /></foreign-key>
</table>
*****************************************************************************************

Now, I have tried this script below but it did not insert data.

	Telsupport newTelsupport = new Telsupport();
	newTelsupport.setMemberId(3);
	newTelsupport.setCustomerNum(1234);
	newTelsupport.setInquiryId(1);
	newTelsupport.setSupportresultId("1");
	newTelsupport.setTelsupport("test");
	newTelsupport.save();


Strange thing is that there is absolutely no error.
I have seen no error when I compile the class file nor in the logs of TOMCAT.
I have checked BaseTelsupport.java and these methods should be working.


*******************************************************************************************
I have another table which looks like this.
<table name="INQUIRY">
  <column name="INQUIRY_ID"      type="INTEGER"  required="true"  primaryKey="true" />
  <column name="INQUIRY"      type="VARCHAR" size="20" default="" />
</table>

On this table, which has no foreign key, I do not have any trouble inserting data with this
:

	Inquiry newInquiry = new Inquiry();
	newInquiry.setInquiryId(3);
	newInquiry.setInquiry("test");
	newInquiry.save();


[environment]
jakarta-struts-1.1-b3
jakarta-tomcat-4.0.6
torque-3.0
Red Hat Linux release 7.1 (Seawolf)
apache_1.3.26
mod_jk-1.3-noeapi.so


Please give me any advice, suggestion on what I should do if you have time.



*--------------------------------*
Tak Fujimoto
Being Co, Ltd.  
[ALLESNET]  Network Division
web   : http://www.alles.or.jp/
email : fujimoto@alles.ad.jp
tel : 03-3226-8421
fax : 03-3226-8425
*--------------------------------*

Mime
View raw message