First of all, thanks to both Thomas :-)

On 03/08/05, Thomas Franke <[EMAIL PROTECTED]> wrote:
> Thomas Dudziak wrote:
> 
> > * Leave the pk generation to the database. In that case, use the
> > native sequence manager.
> With Oracle it would be a problem I think. If I right the native sequence
> manager don't work with Oracle. Therefore we use SequenceManagerNextValImpl 
> and
> leave the pk generation to Oracle.

I can confirm that the native sequence manager doesn't work with Oracle.
That's the first solution I tried, but I couldn't make it work.

Now, back to my problem...
Well, I think I've managed to make things work as I expected.
But the overall problem was slightly more complex.
Here are some more explanations and details:

I had a base class with the ID / xDoclet field definition that all my
persistent classes were extending. It worked fine with OJB's HiLo, but
with *NextValImpl, that wasn't great, especially with
autonaming="true". So in order to define my sequences' names at hand,
I had to define my ID field in all my persistent classes.
I didn't want a single sequence for all my tables.

But that's not all... I still couldn't insert my objects in the
database because some constraints were violated... and they were,
because the *NextValImpl starts inserting values with ID starting at
1! And the globalSequenceStart attribute in the sequence manager
definition isn't taken into account. So I can't specify the index at
which I want to start. What a pity!
The solution to that problem was that I created the sequences manually
after I insert my first init data set, and since OJB doesn't
drop/recreate them, that was just fine. So I used some sequence
creation like so:

CREATE SEQUENCE FOOBAR_SEQ      START WITH 41 MAXVALUE
999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER;

And now, it seems everything is working as expected :-)
So thank you Thomas and Thomas for your help!

Now that I've found what the problem was, I'd like to make a little
suggestion improvement on the PlatformOracleImpl class: Could it be
possible that the method:

 public String createSequenceQuery(String sequenceName)

takes into account the index start sequence hints we pass in the
sequence manager definition? That'd be great!

-- 
Guillaume Laforge
http://glaforge.free.fr/weblog/?catid=2

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

Reply via email to