db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saravana Krishnan Kannan" <saravkr...@uky.edu>
Subject Re: Disable Trigger in Torque?
Date Fri, 27 Aug 2004 17:31:03 GMT
Ferruh,

  Ok this may be a crazy reply... but can you add a new trigger? If yes, how about adding
a trigger to the DelPoint table so that it decrements the id by 1 before doing the insert.

Also another sane suggestion, why not simply set the DelPoint ID manually? You can have native/autoincrement
for the Address... table and a "none" idmethod for DelPoint.

All my suggestions might be wrong since I'm not too sure that I understand your problem.

-Sarav


-----Original Message-----
From: "Ferruh Zamangoer" <ferruh.zamangoer@gistec-online.de>
To: "Apache Torque Users List" <torque-user@db.apache.org>
Date: Fri, 27 Aug 2004 18:29:52 +0200
Subject: Disable Trigger in Torque?

Hi,

thanks again for any reply messages for my Problem. But I was little bit
confused about the messages which settings I have to define in my
schema.xml. The next step what I have done is to test every of your
suggestions and I become the following results.

First a cut of my database schema:

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE database SYSTEM
 "http://db.apache.org/torque/dtd/database_3_1.dtd">

<database
  name="ingeo"
  defaultIdMethod="none"
  skipSql="true">

<!-- #### TABLE ADDRESS_B322 ####-->

<table name="address_b322" description="Address_B322">
<column
  name="idaddress"
  required="true"
  primaryKey="true"
  type="INTEGER"
  size="5"
  description="ID Address"/>
<column
  name="city"
  required="false"
  type="VARCHAR"
  size="4000"
  description="City"/>
<column
  name="adminarea"
  required="false"
  type="VARCHAR"
  size="4000"
  description="Admin Area"/>
<column
  name="postcode"
  required="false"
  type="VARCHAR"
  size="4000"
  description="Post Code"/>
<column
  name="country"
  required="false"
  type="VARCHAR"
  size="4000"
  description="Country"/>
<id-method-parameter name="ADDRESS_ID_SEQ" value="ADDRESS_ID_SEQ"/>
</table>

<!-- #### TABLE ADDRESS_DELPOINT ####-->

<table name="address_delpoint" description="address_delpoint">
<column
  name="idaddress"
  required="false"
  type="INTEGER"
  size="5"
  description="ID Address"/>
<column
  name="delpoint"
  required="false"
  type="VARCHAR"
  size="4000"
  description="Delpoint"/>
  <foreign-key foreignTable="address_b322">
      <reference
        local="idaddress"
        foreign="idaddress"/>
    </foreign-key>
<id-method-parameter value="ADDRESS_ID_SEQ"/>
</table>
......


My Code to insert any data:
---------------------------

AddressB322 ab322 = new AddressB322();
ab322.setAdminarea("FRA");
ab322.setCity("Frankfurt" +  System.currentTimeMillis());
ab322.setCountry("Hessen");
ab322.setPostcode("60313");
ab322.save();

AddressDelpoint ad = new AddressDelpoint();
ad.setAddressB322(ab322);
//ad.setIdaddress(ab322.getIdaddress()); //if i want to set the foreign
manually
ad.setDelpoint("Frankfurt");
ad.save();

My results:

Now you see what happens if use the following settings:

autoincrement:
--------------


	- triggers enabled:
		AddressB322:
		last value in seqeunce is 719.
		Torque want to insert 719, triggers increments the value from Torque to
720

		Datenbank inserts into AddressB322: 720
		Delpoint references Foreign Key 719, but it doesn't exist.

	- triggers disabled:

		AddressB322:

		last value in seqeunce is 723.
		Torque want to insert 723, finalley inserts 723.

		in delpoint table nothing is inerted  ??

		and there are no error message

native:
-------
	- triggers enabled:
		AddressB322:
		last value in seqeunce is 726.
		Torque want to insert 726, triggers increments the value from Torque to
727

		Datenbank inserts into AddressB322: 727
		Delpoint references Foreign Key 726, but it doesn't exist.
	- triggers disabled:

	AddressB322:
		last value in seqeunce is 726.
		Torque want to insert 726, finally insert 726

		Delpoint references foreign Key 726 (everything is okay)
none
----

- triggers enabled:
		AddressB322:
		last value in seqeunce is 735.

		Torque inserts 735
		Delpoint references the foreign Key 735, but when I make a
System.out.println("IDADDRESS: " + ab322.getIdaddress()); in my code I
become the result IdAdress = 0 and Exception is Error: ORA-02291.


	- triggers disabled:

	AddressB322:
		nothings works.


I think only the native method is okay, when I disable the triggers in the
database everything is working fine. But my problem was that I don't want to
disable the triggers. If there is no other workarround I must disable the
triggers or ??


regards
Ferruh


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message