Mike -- Have you considered having OJB use a stored procedure to handle the insert operations? If you do so, you could have the stored procedure return to ojb the 'auto-number' value that was assigned by the trigger. This is what I had to do on a prior project, and that effort lead to the introduction of stored procedure support for insert, update and delete operations. It's been almost a year since I used Oracle in that manner, but I believe the phrase that the SP would use to return the trigger-assigned auto-number to it's 'caller' is "RETURNING". Check out http://db.apache.org/ojb/docu/howtos/howto-work-with-stored-procedures.html, and you'll see the examples that I posted when we implemented the SP support for IUD operations. The example referenced above acquires the next value from a sequence, uses it in the insert operation and returns it to the caller. I believe you could do the same sort of thing with a value that's assigned via the insert trigger.
Ron Gallagher Atlanta, GA -----Original Message----- From: Mike Jackson [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 7:10 PM To: 'OJB Users List' Subject: RE: Sequence managers and insert triggers That's basically how it works. We have triggers which upon insert will populate the "autonumber" fields. The triggers didn't look to see if the autonumber was already populated so if I had used the sequence based implementation I'd have ended up incrementing the sequence twice and none of my fk's would have the proper information in them. This would probably cause integrity constraint violations, but we've since changed the triggers to detect if the autonumber is populated. The dba isn't completely happy with this solution (ojb gets the sequence numbers and populates, anything else doesn't), but he's ok with it. The "normal" route for records is to be inserted for the master record with a stored procedure, but the "child" tables are all direct inserts with triggers to take care of things. --mikej -=----- mike jackson [EMAIL PROTECTED] > -----Original Message----- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: Friday, April 15, 2005 3:42 PM > To: OJB Users List > Subject: Re: Sequence managers and insert triggers > > > Hi Mike, > > think I don't understand your problem (never used insert trigger), so > be patience. If you are using a insert trigger I assume the trigger > set the PK value on insert of new objects? Or do you using a stored > procedure to get the key or to insert the whole object? > > OJB supports database generated sequences. A sequence manager > supporting this kind of key generation can be found here: > http://db.apache.org/ojb/docu/guides/sequencemanager.html#Data > base+sequences+based+implementation > > The SequenceManagerNativeImpl supports database identity columns, > don't know if Oracle supports this (the exception indicate it > doesn't). > > regards, > Armin > > Mike Jackson wrote: > > Actually I take it back, I was getting a -2, but when I got the > > attributes on the identity column set properly I'm getting a > > "java.lang.UnsupportedOperationException: This feature is not > > supported by this implementation". Perhaps this is the > wrong sequence > > manager to use on oracle? > > > > --mikej > > -=----- > > mike jackson > > [EMAIL PROTECTED] > > > > > > > >>-----Original Message----- > >>From: Mike Jackson [mailto:[EMAIL PROTECTED] > >>Sent: Friday, April 15, 2005 2:45 PM > >>To: 'OJB Users List' > >>Subject: Sequence managers and insert triggers > >> > >> > >>I'm running on an Oracle database (8i) with insert triggers to > >>create artifical keys for my table records. The howtos seemed to > >>indicate that SequenceManagerNativeImpl might be the proper sequence > >>manager to use but the keys are coming out goofy, so clearly I'm not > >>understanding or something. > >>Which of the sequence managers should I be using? I've got other > >>applications using the same database, so removing the triggers and > >>using the native sequences via OJB isn't an option at this time. > >> > >>--mikej > >>-=----- > >>mike jackson > >>[EMAIL PROTECTED] > >> > >> > >> > >>------------------------------------------------------------ > --------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]