I've been working with Quinton off the boards for a few hours, but I wanted to get 
this in the archive so others will know about it.  It appears that Torque 3.0 has a 
bug that doesn't allow it to work with Oracle and native sequencing.  Quinton was able 
to make a patch for himself and get his deployment to work, but the same patch did not 
work for me (the generated torque O/R sources no longer compiled with the fix applied).

Hopefully the Torque developers will be able to fix this in the near future.  This 
makes using Torque on an existing database (where other apps/SPs may rely on 
sequences) nearly impossible.

Good luck!

-----Original Message-----
From: Ryan Clifton 
Sent: Tuesday, January 21, 2003 11:54 AM
To: Turbine Users List
Subject: RE: Using IDBroker with existing Oracle sequences


I'm still using Oracle and I'm getting closer, but the IDBroker is still causing me 
headaches.  Below I have a bunch of relevant info about my set up.  Any ideas?  Thanks 
again!  -Ryan

Now when I call save() i get the following error:

org.apache.torque.TorqueException: IdGenerator for table 'PERSON' is null
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:690)
          ...

I have searched the mail archive and found that previous people with this problem had 
the adapter set up incorrectly, however my config for oracle is:

torque.database.default=ryan_test
torque.database.ryan_test.adapter=oracle

The following code throws the error (the first lines are to verify that my connection 
is working.. it is):

          Person person1 = new Person();
        person1 = PersonPeer.retrieveByPK(new NumberKey(1));
        _log.info("Person1:" + person1.getfName());

        person1.setfName("Ryan");
        person1.setlName("Clifton");
        person1.setNew(true);
        person1.setModified(true);
-->     person1.save();

Here is what I get in the logs:

931 [main] DEBUG torque.Torque  - Adding a dummy entry for default, mapped onto
ryan_test
.1212 [Thread-3] DEBUG oid.IDBroker  - IDBroker thread was started.
3846 [main] DEBUG util.BasePeer  - SELECT PERSON.ID, PERSON.FNAME, PERSON.LNAME
FROM PERSON WHERE PERSON.ID=1
3876 [main] DEBUG util.BasePeer  - Elapsed time=30 ms
4026 [main] INFO testcase.TorqueTestCase  - Person1:com.win.core.dao.Person@1f
E..
Time: 3.074
There was 1 error:
1) testPersonDBO(com.win.core.testcase.TorqueTestCase)
org.apache.torque.TorqueException: IdGenerator for table 'PERSON' is null
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:690)
        at com.win.core.dao.BasePersonPeer.doInsert(BasePersonPeer.java:216)
        at com.win.core.dao.BasePersonPeer.doInsert(BasePersonPeer.java:565)
        at com.win.core.dao.BasePerson.save(BasePerson.java:695)
        at com.win.core.dao.BasePerson.save(BasePerson.java:657)
        at com.win.core.dao.BasePerson.save(BasePerson.java:637)
        at com.win.core.testcase.TorqueTestCase.testPersonDBO(TorqueTestCase.jav
a:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at com.win.core.testcase.TorqueTestCase.main(TorqueTestCase.java:28)

FAILURES!!!
Tests run: 3,  Failures: 0,  Errors: 1

-----Original Message-----
From: Quinton McCombs [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 21, 2003 10:33 AM
To: Turbine Users List
Subject: RE: Using IDBroker with existing Oracle sequences


Existing oracle sequences? Hmmm...  Torque picks the name of the
sequence to use for each table for you.  The format is SEQ_<table_name>.
You can get around this by creating synonyms if you can't change the
names but must still use them.

> -----Original Message-----
> From: Ryan Clifton [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 21, 2003 12:17 PM
> To: [EMAIL PROTECTED]
> Subject: Using IDBroker with existing Oracle sequences
> 
> 
> Hello,
> 
> I have recently installed the stand-alone Torque distribution 
> and have basically gotten everything working.. except one 
> critical piece.  I can't for the life of me figure out how to 
> get the IDBroker to link to my existing Oracle sequences and 
> use them.  I've been searching the internet for a few hours 
> and while I've seen plenty of people who say 'use the native 
> setting on IDBroker', I've can't find any instructions on how 
> to actually set it up.
> 
> If you could point me in the right direction or explain how 
> to go about doing what I want, I would really appreciate it.
> 
> Just to explain a bit more of where I am:
> 
> I used the 'jdbc' task to reverse my database into XML.  I 
> then generated my Torque java classes.  I can select existing 
> records, so I know that my db connections are working.  When 
> I insert, I currently get an error stating that the primary 
> key is 'null'.  I was expecting the save() method to 
> automatically fill this in.  I've read and figured out how to 
> get around that by setting 'setNew(true)' and then it will go 
> to the IDBroker.  Then I was thinking, how on earth will the 
> IDBroker know where to go to get the sequence number?  So 
> that's where I am..
> 
> Thanks!
> 
> Ryan Clifton
> 
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to