db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Dietrick <rdietr...@sega.com>
Subject Re: Oracle sequences for id generation
Date Thu, 02 Oct 2003 19:17:32 GMT
Problem solved.  Of course, it was a configuration issue.  I hadn't 
*really* set the adapter property to "oracle" in the Torque.properties file.

thanks for your suggestions.


Robert Dietrick wrote:
> Robles, Rogelio wrote:
> 
>> here a quick sniff test to your problem:
>>
>> after your schema.xml it's complete, did you regenerate your Object Model
>> classes?
> 
> 
> Yes.
> 
>> did you recompile and deploy them? replacing your old ones?
> 
> 
> Yes.
> 
>> usually in the *MapBuilder.java files is wher your primary key method 
>> it's
>> stored;
> 
> 
> here's a snippet from my map builder class:
> 
> TableMap tMap = dbMap.getTable("users");
> tMap.setPrimaryKeyMethod(TableMap.NATIVE);
> tMap.setPrimaryKeyMethodInfo("users_SEQ");
> tMap.addPrimaryKey("users.USER_ID", new Long(0));
> 
> And even after all this, I still get the same error: 
> org.apache.torque.TorqueException: IdGenerator for table 'users' is null
> 
> 
>> did you add the property autoIncrement="true" to the primary key 
>> columns? so
>> the the proper SQL will be generated for native keys?
> 
> 
> I thought autoIncrement was just for MySQL?  I tried this anyway, with 
> no effect.
> 
> Still Stumped.
> 
> -rob
> 
>>> -----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
> 



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