db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bhiyavudh" <bhiyav...@hotmail.com>
Subject Re: Oracle sequences for id generation
Date Thu, 02 Oct 2003 12:58:55 GMT
Hi all,
     Not an answer but a further question. Once you set
defaultIdMethod="native" in schema file, how can you tell torque to use a
particular named sequence create for particular table, for example i have
created "mysequence" for "mytable". How torque know what sequence to use in
oracle database. Where do you set this information?
Regards,

----- Original Message ----- 
From: "Robles, Rogelio" <Rogelio.Robles@experian.com>
To: "'Apache Torque Users List'" <torque-user@db.apache.org>
Sent: Thursday, October 02, 2003 3:36 AM
Subject: RE: Oracle sequences for id generation


>
> here a quick sniff test to your problem:
>
> after your schema.xml it's complete, did you regenerate your Object Model
> classes?
> did you recompile and deploy them? replacing your old ones?
>
> usually in the *MapBuilder.java files is wher your primary key method it's
> stored;
> (here a copy of the MapBuilder.vm)
>
>
> #if ($table.IdMethod == "native")
>         tMap.setPrimaryKeyMethod(TableMap.NATIVE);
> #elseif ($table.IdMethod == "autoincrement")
>         tMap.setPrimaryKeyMethod(TableMap.AUTO_INCREMENT);
> #elseif ($table.IdMethod == "sequence")
>         tMap.setPrimaryKeyMethod(TableMap.SEQUENCE);
> #elseif ($table.IdMethod == "idbroker")
>         tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
> #else
>         tMap.setPrimaryKeyMethod("$table.IdMethod");
> #end
>
> did you add the property autoIncrement="true" to the primary key columns?
so
> the the proper SQL will be generated for native keys?
>
> Rogelio
>
> > -----Original Message-----
> > From: Robert Dietrick [mailto:rdietrick@sega.com]
> > Sent: Wednesday, October 01, 2003 6:15 PM
> > To: torque-user@db.apache.org; torque-dev@db.apache.org
> > Subject: Oracle sequences for id generation
> >
> >
> > I am trying to increase performance by switching from id brokers to
> > Oracle sequences.  I've changed my schema file to use the native id
> > method alla:
> > <database
> >    name="segadb01"
> >    defaultIdMethod="native"
> >
> > Yet, at runtime, when I attempt to store a new record, I get
> > this error:
> > org.apache.torque.TorqueException: IdGenerator for table
> > 'users' is null
> >
> > After looking through my generated classes and the Torque
> > source code,
> > I'm convinced that the addIdGenerator() method of the
> > org.apache.torque.map.DatabaseMap class is never being called
> > with the
> > native IDMethod as an argument.  Thus, when BasePeer tries to get the
> > IdGenerator for my class, it gets a null instead, since only
> > IDBroker's
> > are available for ID generation (I've confirmed this by adding some
> > debugging lines to the Torque source).
> >
> > My question is: What instructs Torque to initialize the idGenerators
> > collection in the DatabaseMap class (via addIdGenerator())?  Is this
> > something dynamic, based on which adapter you're using?  Should
> > something in the schema file be determining this?  Do I need to do it
> > manually?  Is it a bug?
> >
> > I'm using Torque 3.0.  Any help would be appreciated.
> >
> > -rob
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>

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