Armin,
I tested your patch with
<attribute attribute-name="seq.cache"
attribute-value="100"/>
and
<attribute attribute-name="seq.cache"
attribute-value="0"/>
and it works fine on oracle 9i.
Thanks!
Regards,
d.
--
--- Armin Waibel <[EMAIL PROTECTED]> ha scritto:
> Hi Dino,
>
> thanks for the detailed description of this issue. I
> think it's a bug
> caused by
> PlatformOracleImpl#createSequenceQuery(String
> sequenceName, Properties prop)
>
> This method build the sequence-String and does
> ignore the NOCACHE
> setting. This will be fixed in upcoming OJB 1.0.5
> (SVN OJB_1_0_RELEASE
> branch).
> You can patch class
> org.apache.ojb.broker.platforms.PlatformOracleImpl
> with:
>
> value =
> SequenceManagerHelper.getSeqCacheValue(prop);
> if(value != null)
> {
> long cache = value.longValue();
> if(cache > 0) query.append(" CACHE
> ").append(value.longValue());
> else query.append(" NOCACHE");
> }
>
> I don't have a Oracle database installation to test
> my patch, so it will
> be helpful if you could verify the patch.
>
> regards,
> Armin
>
> [EMAIL PROTECTED] wrote:
> > Many thanks Armin for your answer.
> >
> > You are right for the documentation. :(
> > I only looked at SequenceManagerNextValImpl
> javadoc
> > and no other keys rather than 'autoNaming' were
> > mentioned.
> >
> > I just ported the application to ojb 1.0.4.
> However
> > when I set the following in the
> repository_database
> >
> > <sequence-manager
> >
>
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
> > <attribute attribute-name="autoNaming"
> > attribute-value="true"/>
> > <attribute attribute-name="seq.cache"
> > attribute-value="0"/>
> > </sequence-manager>
> >
> > I get the following error:
> >
> > Creation of new sequence failed with
> > ORA-04010: il numero di valori per CACHE deve
> essere
> > maggiore di 1
> >
> > at
> >
>
org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.getUniqueLong(Unknown
> > Source)
> > at
> >
>
org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(Unknown
> > Source)
> > at
> >
>
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.assignAutoincrementSequences(Unknown
> > Source)
> > ... 40 more
> > Caused by: java.sql.SQLException: ORA-04010: il
> numero
> > di valori per CACHE deve essere maggiore di 1
> >
> > at
> >
>
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
> > at
> >
>
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
> > at
> >
>
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
> > at
> >
>
oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:625)
> > at
> >
>
oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:112)
> > at
> >
>
oracle.jdbc.driver.T4CStatement.execute_for_rows(T4CStatement.java:560)
> > at
> >
>
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1153)
> > at
> >
>
oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1647)
> > at
> >
>
com.evermind.sql.FilterStatement.execute(FilterStatement.java:27)
> > at
> >
>
com.evermind.sql.FilterStatement.execute(FilterStatement.java:27)
> > at
> >
>
com.evermind.sql.StatementBCELProxy.execute(StatementBCELProxy.java:240)
> > at
> >
>
org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.createSequence(Unknown
> > Source)
> > ...
> > ...
> >
> > It does not accept 0 as cache value.
> > In fact if I open a sqlplus shell, the following
> > command
> >
> > SQL> alter sequence SEQ_SUPPLIES cache 20;
> >
> > works fine.
> >
> > Instead the following does not work:
> >
> > SQL> alter sequence SEQ_SUPPLIES cache 0;
> > alter sequence SEQ_SUPPLIES cache 0
> > *
> > ERRORE alla riga 1:
> > ORA-04010: il numero di valori per CACHE deve
> essere
> > maggiore di 1
> >
> >
> > To reset the cache it seems only the following
> command
> > works:
> >
> > SQL> alter sequence SEQ_SUPPLIES nocache;
> >
> > I have the following Oracle version:
> >
> > Oracle9i Enterprise Edition Release 9.2.0.1.0 -
> > Production
> > With the Partitioning, OLAP and Oracle Data Mining
> > options
> > JServer Release 9.2.0.1.0 - Production
> >
> > Do you know this behaviour?
> >
> > Thanks!
> >
> > Dino.
> >
> > ps.
> > I am sorry Armin for the wrong email address of my
> > first message, I just replied to the OJB Users
> List to
> > share this issue with the community.
> > --
> >
> > --- Armin Waibel <[EMAIL PROTECTED]> ha scritto:
> >
> >> Hi Dino,
> >>
> >> Dino Di Cola wrote:
> >>> Armin,
> >>>
> >>> I have a question regarding ojb and oracle
> >> sequences.
> >>> I am using the following sequence-manager
> >>>
> >>> <sequence-manager
> >>>
> >
>
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
> >>> <attribute attribute-name="autoNaming"
> >>> attribute-value="true"/>
> >>> </sequence-manager>
> >>>
> >>> and the sequences get automatically created with
> >> CACHE
> >>> parameter set to 20. I am encountering some
> >> problems
> >>> with Oracle 10g and it seems that the 20 is
> added
> >> to
> >>> the sequence current value to generate the next
> >> value.
> >>> How can I configure OJB by automatically
> creating
> >>> sequences with NOCACHE?
> >>> Is SequenceManagerNextValImpl configurable or
> have
> >> I
> >>> to Implement a sequence manager by myself?
> >>>
> >> Please have a look into OJB's documentation
> >>
> >
>
http://db.apache.org/ojb/docu/guides/sequencemanager.html#Database+sequences+based+implementation
> >> You can set an attribute 'seq.cache'
> >> <attribute attribute-name="seq.cache"
> >> attribute-value="0"/>
> >>
> >> These properties are supported since OJB 1.0.4.
> If
> >> you use an older
> >> version of OJB you can extend
> >> SequenceManagerNextValImpl to implement
> >> your specific SM - e.g. override method
> >> #createSequence(...)
> >>
> >> By the way please post your questions to OJB's
> >> user-list - Thanks.
> >>
> >> regards,
> >> Armin
> >>
> >>
> >>> Many thank in advance for your help.
> >>>
> >>> Dino.
> >>> --
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> ___________________________________
> >>> Yahoo! Mail: gratis 1GB per i messaggi e
> allegati
> >> da 10MB
> >>> http://mail.yahoo.it
> >>>
> >>
> >
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED]
> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
> >
> > ___________________________________
> > Bolletta salata? Passa a Yahoo! Messenger with
> Voice
> > http://it.messenger.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > 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]
>
>
___________________________________
Bolletta salata? Passa a Yahoo! Messenger with Voice
http://it.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]