You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Ferruh Zamangoer <fe...@gistec-online.de> on 2004/08/26 14:09:58 UTC

Disable Trigger in Torque?

Hi,

does anybody know if it's possible to disable the trigger mechanism inside
torque. My problem is that I have defined triggers in my Oracle database and
when I'am inserting new Data, the ID(Primary Key) field is increment by
Torque and by my trigger which I have defined. For Example the last value of
my sequence is 134 but the db inserts 136.

Thanks for any help.

Regards
Ferruh


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


Re: Disable Trigger in Torque?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Ferruh Zamangoer" <fe...@gistec-online.de> writes:

>does anybody know if it's possible to disable the trigger mechanism inside
>torque. My problem is that I have defined triggers in my Oracle database and
>when I'am inserting new Data, the ID(Primary Key) field is increment by
>Torque and by my trigger which I have defined. For Example the last value of
>my sequence is 134 but the db inserts 136.

Use another ID generator (do we have docs besides the Javadocs for
this somewhere around?). There _should_ be one, that allows the
database to do the ID generation (similar to MySQL autoincrement
columns).

(This is a woefully underdocumented region of Torque, sorry). 

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

"Fighting for one's political stand is an honorable action, but re-
 fusing to acknowledge that there might be weaknesses in one's
 position - in order to identify them so that they can be remedied -
 is a large enough problem with the Open Source movement that it
 deserves to be on this list of the top five problems."
                       -- Michelle Levesque, "Fundamental Issues with
                                    Open Source Software Development"

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


Re: Disable Trigger in Torque?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Robert Bowen <sy...@yahoo.com> writes:

>... What Torque will then do is use the sequences
>defined by the database. In order for this to work you
>need to tell Torque the name of the sequence for every
>table:

><table name="apd_acces" description="acces">
><id-method-parameter name="apd_acces_id_acces_seq"    
>value="apd_acces_id_acces_seq"/>

If you omit this, Torque will use "<tablename>_SEQ" automatically. I
use this e.g. to let all my tables use the same sequence (just as
Hibernate does)".

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

"Fighting for one's political stand is an honorable action, but re-
 fusing to acknowledge that there might be weaknesses in one's
 position - in order to identify them so that they can be remedied -
 is a large enough problem with the Open Source movement that it
 deserves to be on this list of the top five problems."
                       -- Michelle Levesque, "Fundamental Issues with
                                    Open Source Software Development"

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


AW: Disable Trigger in Torque?

Posted by Ferruh Zamangoer <fe...@gistec-online.de>.
Hi Bowen,

what I forgot to mentoined is that I don't use the sql-scripts which is
generated by Torque to create the DB. I've become from a customer a dump
file and want to insert and delete some data from this database. I have a
restricition that I can not edit or delete something in the database
settings, schema, triggers ....

I have the following settings:

database definition:
--------------------

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

table defintion:
----------------

<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>


In the databse the following trigger is defined, which is calle by any
insert:

Trigger definition:
-------------------

TRIGGER "ADVMIS".Address_BIns
BEFORE INSERT ON ADDRESS_B322
FOR EACH ROW
DECLARE
   nummer  NUMBER;
BEGIN
   SELECT Address_id_Seq.NEXTVAL INTO nummer  FROM sys.dual;
   :NEW.idAddress := nummer;
END;


When I disable the triggers in Oracle DB everything is working fine, but I
will not disable the triggers settings in the Database, I will disable it in
Torrque?

(Thanks for any help)2

Regards
Ferruh





-----Ursprungliche Nachricht-----
Von: Robert Bowen [mailto:syg6@yahoo.com]
Gesendet: Donnerstag, 26. August 2004 14:14
An: Apache Torque Users List
Betreff: Re: Disable Trigger in Torque?


You need to set the defaultIdmethod for ALL of your
tables to native:

<database name="apdcat" defaultIdMethod="native">

... What Torque will then do is use the sequences
defined by the database. In order for this to work you
need to tell Torque the name of the sequence for every
table:

<table name="apd_acces" description="acces">
<id-method-parameter name="apd_acces_id_acces_seq"
value="apd_acces_id_acces_seq"/>

... This way Torque will call the sequence and assign
the new id correctly.

FYI, if you have a table with a non-auto-increment
primary key you must do the following:

<table name="apd_acces_perfil" idMethod="none"

... so Torque doesn't try to apply the "native" method
to this specific table ...

Cheers,
syg




--- Ferruh Zamangoer
<fe...@gistec-online.de> wrote:

> Hi,
>
> does anybody know if it's possible to disable the
> trigger mechanism inside
> torque. My problem is that I have defined triggers
> in my Oracle database and
> when I'am inserting new Data, the ID(Primary Key)
> field is increment by
> Torque and by my trigger which I have defined. For
> Example the last value of
> my sequence is 134 but the db inserts 136.
>
> Thanks for any help.
>
> Regards
> Ferruh
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
>
>




_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

---------------------------------------------------------------------
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


Re: Disable Trigger in Torque?

Posted by Robert Bowen <sy...@yahoo.com>.
You need to set the defaultIdmethod for ALL of your
tables to native:

<database name="apdcat" defaultIdMethod="native">

... What Torque will then do is use the sequences
defined by the database. In order for this to work you
need to tell Torque the name of the sequence for every
table:

<table name="apd_acces" description="acces">
<id-method-parameter name="apd_acces_id_acces_seq"    
value="apd_acces_id_acces_seq"/>

... This way Torque will call the sequence and assign
the new id correctly.

FYI, if you have a table with a non-auto-increment
primary key you must do the following:

<table name="apd_acces_perfil" idMethod="none"

... so Torque doesn't try to apply the "native" method
to this specific table ...

Cheers,
syg




--- Ferruh Zamangoer
<fe...@gistec-online.de> wrote:

> Hi,
> 
> does anybody know if it's possible to disable the
> trigger mechanism inside
> torque. My problem is that I have defined triggers
> in my Oracle database and
> when I'am inserting new Data, the ID(Primary Key)
> field is increment by
> Torque and by my trigger which I have defined. For
> Example the last value of
> my sequence is 134 but the db inserts 136.
> 
> Thanks for any help.
> 
> Regards
> Ferruh
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 
> 



		
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

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