db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alvin Antony" <Alvin.Ant...@internet.lmu.de>
Subject Antw: Unable to insert data into a table with foreign keys
Date Tue, 13 May 2003 12:32:28 GMT
Hello,

          you didn't say something about ,what is the exception thrown
, when you try to save the object.

Other point missing in your mail is, how is the "database"  element
looks in the schema file, I didn't see, any "idMethod" attribute
specfied for   SUPPORTRESULT table, that means this table is using the
one specified on the database element.
 You would have to say idMethod="none", if you want to create the
primary key on your code.


HTH,

Alvin

>
>
>>>> t-fujimoto@beingcorp.co.jp 05/13 12:40  >>>
>I am unable insert data into a table which has three foreign
references.
>
>
>This is the part of project-schema.xml which describes the table I am
having a trouble with.
>**************************************************************************************
>  <table name="TELSUPPORT" idMethod="native">
>    <column name="TELSUPPORT_ID"      type="INTEGER"  required="true"
primaryKey="true" />
>    <column name="MEMBER_ID"      type="INTEGER"  required="true"  />
>    <column name="DATE"    type="DATE"   required="true"  />
>    <column name="TIME"    type="TIME"  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="LONGVARCHAR"  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>
>
>  <table name="MEMBER" idMethod="native">
>    <column name="MEMBER_ID"      type="INTEGER"  required="true" 
primaryKey="true" />
>    --------------------------------------------------------
>  </table>
>
>  <table name="INQUIRY">
>    <column name="INQUIRY_ID"      type="INTEGER"  required="true" 
primaryKey="true" />
>    --------------------------------------------------------
>  </table>
>
>  <table name="SUPPORTRESULT">
>    <column name="SUPPORTRESULT_ID"      type="CHAR" size="1"
required="true"  primaryKey="true" />
>    --------------------------------------------------------
>  </table>
>**************************************************************************************
>
>Now, this is a part of the source which I use Torque with struts.
>
>public ActionForward execute ( ActionMapping mapping,
>            ActionForm form,
>            HttpServletRequest request,
>            HttpServletResponse response) {
>
>	Integer memberId = (Integer)session.getAttribute("memberId");
>	MainForm mainForm = (MainForm)form;
>
>            Member member = new Member();
>            member.setMemberId(memberId.intValue());
>            Inquiry inquiry = new Inquiry();
>            inquiry.setInquiryId(mainForm.getFormInquiryId());
>            Supportresult supportresult = new Supportresult();
>           
supportresult.setSupportresultId(mainForm.getFormSupportresultId());
>
>            Telsupport newTelsupport = new Telsupport();
>            newTelsupport.setMemberId(member.getMemberId());
>            newTelsupport.setDate(sqlDate);
>            newTelsupport.setTime(sqlTime);
>            newTelsupport.setCustomerNum(
mainForm.getFormCustomerNum());
>            newTelsupport.setInquiryId(inquiry.getInquiryId());
>           
newTelsupport.setSupportresultId(supportresult.getSupportresultId());
>            newTelsupport.setTelsupport(
mainForm.getFormTelsupport());
>            newTelsupport.save();
>
>return (mapping.findForward("success"));
>}
>
>**************************************************************************************
>
>[setup]
>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
>
>I refered to http://db.apache.org/torque/tutorial/step4.html and 
>I am trying to inserting the foreign-keys manually.
>
>Please give me any advice, suggestion on what I should do if you have
time.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org 
>For additional commands, e-mail: torque-user-help@db.apache.org 
>


Alvin K. Antony
Ludwig-Maximilians-Universität München
Internet und Virtuelle Hochschule
Softwareentwicklung
Oettingenstraße 67
80538 München
Germany
-------------------------------------------
Phone: +49 (0)89 2102-5979
Fax: +49 (0)89 2102-5980
Mobile: +49 (0)175 9401175
E-Mail: aantony@lmu.de

Web: http://www.lmu.de/internet/


Mime
View raw message