Oracle Sequence Numbers

I have a unit of work where I'm adding a record to 2 different tables. The first table uses a oracle sequence number for the primary key. The second table needs the number as well. I use the assignSequenceNumber method and I get the number before the commit. The second table has the correct number. The first table has the next sequence number available. (+1) I look at the messages in the weblogic log and toplink does a nextval from dual in the uow before the commit. (number used by second table) It does another nextval from dual during the commit. (second table has number + 1) Does anyone know why this is happening?
Thanks in advance.

By deafault, TopLink assigns sequence number during the commit. However, if you assign them yourself first, TopLink will not assign the numbers during commit. Check the objects before you call commit and make sure that neither of them have a null (or 0 in the case of a primitive) primary key.
Peter Krogh

Similar Messages

  • Back numbers in Oracle sequences

    We are using a J2EE based tool that uses Oracle as backend. For several purposes the tool use the oracle sequences. As per general rule the every time the sequence is referred, it generates a next higher number and returns the same for any kind of storage purposes like primary key, etc. But in rare cases we have got a previous number of the sequence instead of a next higher value. We aren't sure if that previous number was ever used before or not. But the problem is how does the oracle sequence return a previous number? e.g. we have a sequence running as 220, 221, 222, etc. then suddenly instead of returning 223 the next time, it may give the number 214 (or basically any previous number).
    Does anybody know why does that happen? What could be the possible reasons and how it can be avoided? It creates confusion amongst users and does not seem just right to get a previous number. Any help is appreciated. Thanks.

    Connection pooling should have no effect on this issue since the Oracle sequences should be cached in Oracle and not in the pooled session.
    RAC as mentioned would since each instance would have its own sequence cache: instance A values 1 - 5, instance B values 6 - 10, instance C 11 - 15.
    Then depending on which instance the user session was connected to the ticket numbers would appear to be selected from an earlier point in the sequence.
    On a non-RAC instance you can see this apparent behavior where the application gets the sequence number on the first screen and passes the value to later screens but the number is not inserted into a database table until the final screen that creates the ticket. If it takes the user longer to create the ticket than other users who started later then the ticket number would appear earlier than the earlier created tickets.
    The solution to this "problem" for non-RAC or RAC is to insert a timestamp at the time of ticket creation (or start) and to process the tickets in timestamp rather than ticket number order. After all the ticket number is just an identifier and there is really no logical reason that tickets have to be processed in ticket number order.
    If it is a political issue then you could use a dual key system. Assign one key at creation time, transaction key, and then assign the ticket number via batch based on either the timestamp of when ticket entry started or was submitted. Now the ticket numbers represent whatever order you need. You can notify the users of the ticket number via email.
    HTH -- Mark D Powell --

  • Sequence numbers not generated sequentially?

    Our situation: We have encountered an issue with our database, where it appears that a sequence has generated a number out of sequence, that is, to fill in a gap left previously. That is, in the affected table, we have records like:
    Seq No Date (DD/MM/YY)
    1 29/12/08
    2 29/12/08
    3 4/1/09
    4 29/12/08
    The code that actually updates the database is from a third party, so I am unable to prove the following, but the vendor assures me that:
    1. The sequence numbers are generated using "select message_number.nextval from dual".
    2. The Date column is not modified after the record is created. ( Nor is it supposed to be )
    The sequence is created by "CREATE SEQUENCE MESSAGE_NUMBER START WITH 10000000 INCREMENT BY 1 MINVALUE 10000000 CACHE 20 NOCYCLE NOORDER"
    This was detected only yesterday, after the event, and is very uncommon ( I have not found another instance, but there are over 7,000,000 records, so I haven't performed an exhaustive search). We are relying on the sequence numbers always being generated sequentially, as in each message_number.nextval is greater than the previous one.
    I don't think that the date change was due to a user accidentaly changing the date. Related records to '3' are also dated 4/1/09, there is no facility for a user to change the date outside of accessing the database directly, and even the developers do not have write access to this database.
    My questions:
    1. Is this normal behaviour for a sequence? To go back and fill in a gap like this? If so we'll have to change one of the assumptions of one of our modules.
    2. Should the sequence be defined with 'ORDER' rather than 'NOORDER' to stop this?
    3. Could this be a bug in the sequence number generation? We are using Oracle 9.2.0.1.0.
    4. Is this situation "impossible", and therefore there is a bug in the vendor library that we need to track down.
    Thanks for your help,
    Wayne.

    wayneb wrote:
    Our situation: We have encountered an issue with our database, where it appears that a sequence has generated a number out of sequence, that is, to fill in a gap left previously. That is, in the affected table, we have records like:
    Seq No Date (DD/MM/YY)
    1 29/12/08
    2 29/12/08
    3 4/1/09
    4 29/12/08
    The code that actually updates the database is from a third party, so I am unable to prove the following, but the vendor assures me that:
    1. The sequence numbers are generated using "select message_number.nextval from dual".
    2. The Date column is not modified after the record is created. ( Nor is it supposed to be )There might be a delay between fetching the sequence and storing the sysdate? value in the database.
    maybe some user prepared a new record. Then went to some new years eve party and when he came back at the begining of next year he commited the data (record send to database, database is adding date column by some trigger...).
    >
    The sequence is created by "CREATE SEQUENCE MESSAGE_NUMBER START WITH 10000000 INCREMENT BY 1 MINVALUE 10000000 CACHE 20 NOCYCLE NOORDER"
    This was detected only yesterday, after the event, and is very uncommon ( I have not found another instance, but there are over 7,000,000 records, so I haven't performed an exhaustive search). We are relying on the sequence numbers always being generated sequentially, as in each message_number.nextval is greater than the previous one.
    I don't think that the date change was due to a user accidentaly changing the date. Related records to '3' are also dated 4/1/09, there is no facility for a user to change the date outside of accessing the database directly, and even the developers do not have write access to this database.
    My questions:
    1. Is this normal behaviour for a sequence? To go back and fill in a gap like this? If so we'll have to change one of the assumptions of one of our modules.No sequences don't fill gaps. However it is possible to fetch and cache values from a sequence for later usage. Especially in a RAC environment you can get sequence values that are not in order of time.
    2. Should the sequence be defined with 'ORDER' rather than 'NOORDER' to stop this?No.
    3. Could this be a bug in the sequence number generation? We are using Oracle 9.2.0.1.0.Extremly unlikely, but you can always check Metalink.
    4. Is this situation "impossible", and therefore there is a bug in the vendor library that we need to track down.You can create such situations programatically. Whether it is a bug depends on the specifications for the software.
    >
    Thanks for your help,
    Wayne.Edited by: Sven W. on Mar 24, 2009 5:00 PM

  • Oracle sequence problem in CMP Entity EJB

    I have a problem with Oracle sequence when I am using from the CMP entity EJB in WebLogic
    6.1:
    The problem is when the WebLogic server starts it acquires the correct sequence number
    from Oracle, but during the runtime, when I open a new sqlplus window and increment
    the sequence number, the container is not picking up from the new incremented value
    instead it is still continuining by incrementing the old sequence number it has acquired
    when it fetched from Oracle last time.
    The sequence increment and key-cache-size in weblogic-cmp-rdbms-jar.xml are exactly
    same
    Any help would be greatly appreciated.

    Change the key-cache-size to 1 in weblogic-cmp-rdbms-jar.xml and then try
    your experiment again.
    -- Anand
    "Satya" <[email protected]> wrote in message
    news:3d06274c$[email protected]..
    >
    I have a problem with Oracle sequence when I am using from the CMP entityEJB in WebLogic
    6.1:
    The problem is when the WebLogic server starts it acquires the correctsequence number
    from Oracle, but during the runtime, when I open a new sqlplus window andincrement
    the sequence number, the container is not picking up from the newincremented value
    instead it is still continuining by incrementing the old sequence numberit has acquired
    when it fetched from Oracle last time.
    The sequence increment and key-cache-size in weblogic-cmp-rdbms-jar.xmlare exactly
    same
    Any help would be greatly appreciated.

  • Documents Sequence numbering for each Branch (Branch as segment)

    dear Brother's
    can help me in this case
    Documents Sequence numbering for each Branch (Branch as segment)
    Each branch have an own sequence
    I implement oracle Business suite ERP for Five Branch ( KSA,INDIA,DUBIA ,JORDAN ,SYRIA )
    I want to segregate sequence numbering for each branch, sequence for (
    Sales order, invoice, purchase order, Invoice)
    Is there a possibility to link sequence with any segment I define it in COA like Branch
    Note: I work in single Operating Unit

    Hi,
    You might be able to adapt this solution to work for your case: https://acrobat.com/#d=*2slxPLc6c-H0U449vA4jQ. It's more about page numbers for different Master Pages, but you may be able to tie it to the different data nodes.
    Niall

  • Bulk Fetch From an Oracle Sequence

    I am trying to get a range of sequence values from an Oracle sequence.
    I am using the option as show below using query
    SELECT SEQUENCE_NAME.NEXTVAL FROM SYS.DUAL CONNECT BY LEVEL <= 10.
    The above SQL gets 10 sequence value.
    I just wanted to to check, if the implementation below is safe in a Multi User Environment?
    Is the statement show below atomic. i.e. Multi parallel execution of the same function; Would it cause any inconsistencies?
    EXECUTE IMMEDIATE 'SELECT SEQUENCE_NAME.NEXTVAL ' ||
      'FROM SYS.DUAL CONNECT BY LEVEL <= ' || TO_CHAR(i_quantity)
      BULK COLLECT INTO v_seq_list;
    FUNCTION select_sequence_nextval_range(
       i_quantity      IN  INTEGER)
    RETURN INTEGER IS
      o_nextval INTEGER;
      v_seq_list sequence_list;
    BEGIN
      EXECUTE IMMEDIATE 'SELECT SEQUENCE_NAME.NEXTVAL ' ||
      'FROM SYS.DUAL CONNECT BY LEVEL <= ' || TO_CHAR(i_quantity)
      BULK COLLECT INTO v_seq_list;
      -- Get the first poid value.
      o_nextval := v_seq_list(1);
      RETURN o_nextval;
    END select_sequence_nextval_range

    Acquire Lock
    You acquire a lock on a sequence? That's news to me - please post the code that does that. I certainly hope you don' t mean you are directly accessing the SYS.SEQ$ table to lock the row for that sequence - it isn't nice to mess with Oracle's tables!
    For couple of JAVA/C applications the usage of sequence number is pretty big. Could be 100,000 for one single application processing.
    How does that correlate with your previous statement that you get 10 at a time?
    Sequences aren't designed for use cases that require gap-free sets of numbers or for use cases that require consecutive sets of numbers.
    We wanted to implement the range get of sequence using a different mechanism.
    For few other applications; we just need one sequence number for the application processing. So we use the select seq.nextval to get the value. So the same sequence number needs to serve the role of giving a single value as well as a consecutive range of values.
    Then you may need to consider using your own table to track the chunks that need to be allocated. You would use a scheme similar to what Greg.Spall discussed except you would keep the 'chunk' data in your own table.
    I'm not talking about using your own table to control actual one-by-one sequence number generation - that is a very bad idea. But if you need to work with large ranges that are allocated infrequently there is nothing wrong with using your own function and your own table to keep track of those allocations.
    The 'one by one' number generation would be handled by an actual sequence. The generation of a 'start value' and an 'end value' would be handled by accessing your custom table. Each row in that table would have 'start_value' and 'available_numbers' colulmns.
    Your function would take a parameter for how many numbers you need. For just one number the function would call the sequence.nextval and return that along with a count of '1'.
    For a range the function would:
    1. find a row in the table with an 'available_numbers' value large enough to satisfy the request,
    2. lock the row for update
    3. capture the 'start_value' for return to the user
    4. adjust both the 'start_value' and 'available_numbers' values to account for the range being allocated
    5. update the table and commit
    6. return the 'start_value' and 'number_allocated' to the user (number_allocated might be LESS than requested perhaps)
    The above is a viable solution ONLY if the frequency of allocation and the size of allocation avoids the serialization issues associated with trying to allocate your own sequence numbers.
    Those issues can be somewhat mitigated by having the table store multiple rows with each row having a large chunk of values that can be allocated. Then your function query can get the first 'unlocked' row and avoid serializing just because one row is currently locked.

  • How to use A RowSet with an Oracle sequence

    Hi,
    I created a RowSet with the RowSet wizard and it asked me if I wanted to use database created primary keys. I'm using Oracle so I selected this option and want to use Oracle sequences. But I don't find where should I configure the name of the Oracle sequence. Accordingly I cannot insert through the RowSet.
    Many thanks in advance.
    Nick

    b j t wrote:
    Pancenter wrote:
    That seems kind of strange...
    I have a 10.1" Acer Android tablet that can use a bluetooth and/or USB mouse and keyboard.
    I do realize that Android has "input" ports, the point I am making is that the iPad does not.
    The question the OP asked was:
    Why is there no application to run a mouse on an iPad? I would like to be able to work with Numbers and Pages withouit having to keep touching the screen.
    and I stand by the answer I gave which was:
    There is NO way to use a mouse with the iPad, you will have to either use your finger or a stylus to navigate around the screen.
    You may have to stand down. Youtube is swarmed with instructional video's about how to use Mouse (and keyboard) with an iPad. So there is a way. I don't understand why you insist on something when it clearly and easy Googly discoverably is not true.

  • Sequence numbers - with no gaps!

    I seek some advice from anyone with first hand experience in this area.
    My need is simple; generate a new ID number for every order for use as the primary key.
    Obviously this simple exercise could be a bottleneck as volumes ramp up, so I was pleased to find the Oracle feature to generate such numbers (efficiently presumably). However, upon closer reading it was apparent that aborted transactions would result in the loss of the number allocated to to that order if another transaction had obtained the next sequence number already (as one would want it to, rather than serializing transactions).
    I don't want to have gaps in the sequence as the system needs a high degree of auditability. I am thinking of utilising the Autonomous Transaction feature to write the newly acquired sequence number to the order file with a flag indicating that the record is incomplete, and that record is to be skipped by normal system applications (but available to audit reports which will interpret the reason correctly), then returning to the far more extensive main transaction which updates many tables.
    The other alternative is to control sequence numbers within the application itself, or try to get the sequence number as the very last step before writing the new order record, but this probably won't guarantee gapless reliability either. The ID itself has no significance, and it doesn't matter if an ID was used out of strict date/time sequence, so I really don't want to execute these updates serially.
    So, my question is this:
    a) do most people use the builtin sequence number feature?
    b) if so, is there a standard technique for avoiding or accounting for gaps?
    c) if the application must take over this task, should the counter for the last used ID be in a single row table to minimise bottlenecks caused by the thisrecord being locked? There will be several such counters for different aspects of the application, and i thought of having each in its own row in a small table, but I'm concerned about the whole table getting locked and freezing out otherwise-unrelated updates.
    Thanks for any advice you may have.
    CS

    user8821725 wrote:
    I seek some advice from anyone with first hand experience in this area.
    My need is simple; generate a new ID number for every order for use as the primary key.
    Obviously this simple exercise could be a bottleneck as volumes ramp up, so I was pleased to find the Oracle feature to generate such numbers (efficiently presumably). However, upon closer reading it was apparent that aborted transactions would result in the loss of the number allocated to to that order if another transaction had obtained the next sequence number already (as one would want it to, rather than serializing transactions).
    I don't want to have gaps in the sequence as the system needs a high degree of auditability. One of the very very few reasons for me to have a requirement for "gapless" sequences is if you have a kind of checking mechanism outside of the database that is implemented using this gapless number. I had such a requirement once, when exchanging files with another bank where we had to ensure that each file was transferred correctly and in the right order. Your "high degree of auditability" might be a similiar requirement. Just remember as long as you are still inside the database you can use other mechanisms to increase auditability.
    I am thinking of utilising the Autonomous Transaction feature to write the newly acquired sequence number to the order file with a flag indicating that the record is incomplete, and that record is to be skipped by normal system applications (but available to audit reports which will interpret the reason correctly), then returning to the far more extensive main transaction which updates many tables.Hm. I don't see why you want to use Autonomous Transactions for this. It might be useful to lessen locking conflicts , depending how your future sequence mechanism will be built.
    >
    The other alternative is to control sequence numbers within the application itself, or try to get the sequence number as the very last step before writing the new order record, but this probably won't guarantee gapless reliability either. The ID itself has no significance, and it doesn't matter if an ID was used out of strict date/time sequence, so I really don't want to execute these updates serially.I would go for generating the sequence as the very last step. It needs to be set to NOCACHE of cause. This will garantee that the sequence fetched from mySeq.nextval is gapless. The problem is then in your application. Your application must be built in a way that it ensures to use this sequence, or at least to create a noticable alert when this generated sequence can't be used anymore. In essence this means. Each unhandled (database) error that happens after you fetched the next sequence value must be raised in a way that informs all relevant people about this error.
    Example: It might be that you use the sequence to write an order file. What happens if halfway through writing the file your disk runs out of space? This can be such an issue where a sequenced value will be lost. Your organisation must take care of those things.
    >
    So, my question is this:
    a) do most people use the builtin sequence number feature?Yes. But for some tasks a sequence is not the best way, for example if you want a numbering for each item of your order. This "sequence" needs to restart with every new order.
    b) if so, is there a standard technique for avoiding or accounting for gaps?NOCACHE => Avoids gaps during generation
    Database Trigger => Tries to use the sequence as late as possible
    c) if the application must take over this task, should the counter for the last used ID be in a single row table to minimise bottlenecks caused by the thisrecord being locked? There will be several such counters for different aspects of the application, and i thought of having each in its own row in a small table, but I'm concerned about the whole table getting locked and freezing out otherwise-unrelated updates.This is a possibility and the issues you describe are why we avoid such a solution in general. Autonomous transactions help to reduce the locking conflict, but they increase the chance that you produce gaps.
    >
    Thanks for any advice you may have.
    CSOracle can guarantee to produce gapless sequences. But it can't guarantee that your application uses such a sequence in a gapless way.

  • Oracle sequence from JSP

    Hi,
    I have to generate sequence numbers in Oracle and access it through my JSP page. For that i
    created a sequnce in Oracle as:
    create sequence trans_no increment by 1 start with 1 maxvalue 10000 minvalue 1;
    and in my JSP page, the following code is given:
    ResultSet resultSet=db.executeQuery("select trans_no.nextval from dual");
    resultSet.next();
    int transaction_no=resultSet.getInt("trans_no");
    where db is my bean. But it is giving error. Is my code wrong? Please help.
    Suman, Kochi

    There is a mistake in mapping for ResultSet with the query you executed.
    You have to modify either the query as
    ResultSet resultSet=db.executeQuery("select trans_no trans_no.nextval from dual");
    or have to change retreival from ResultSet to
    int transaction_no=resultSet.getInt(1);
    This should work now.
    Try this and see...

  • Recycled Sequence Numbers

    Hi,
    We have a requirement of generating sequence numbers for a table and we need to recycle them if some of them is deleted.
    For example the following tabe Employee(Id,name)
    ID NAME
    1 XXX
    2 YYY
    3 ZZZ
    4 AAA
    The ID filed should have the next sequence number generated. When I call getnextID now, it should return 5
    ID NAME
    1 XXX
    2 YYY
    3 ZZZ
    4 AAA
    5 BBB
    Now Let us assume I delete 3. The contents of the table aare
    ID NAME
    1 XXX
    2 YYY
    4 AAA
    5 BBB
    Now when getNextID, 3 should be returned.
    How to achieve this in a best performing way in Oracle? Are there any patterns around it? Please note this should run in a multi user environment.
    Thanks,
    Rama

    I think the answers were based on the fact that you call it incorrectly sequence.
    Your ConnectivityID is more as a resource that could be recycled. I see some similarities to the GSM telecom market where a resource(i.e. a phone number or a SIM card no) can be recycled when is not active anymore (under certain conditions however).
    Personally I would generate a table of resources having the resource number (ConnectivityID) and resource status.
    To simplify it, suppose that you have column status with 2 possible values, 0=available, 1=not available.
    When you want to allocate the resource number(ConnectivityId) you will set the status to 1.
    When the record is deleted then status will be updated back to 0.
    Recycling a ConnectivityID will mean searching in the table for the lowest number having status=0.
    Of course you don't expect this to be as fast as a sequence but I think this is a different requirement, IMO.
    Regards
    Al

  • Alter a column with sequence numbers

    Hi to all,
    i have a table (sample) with cplumns: sno, sname,dob and so on..........
    In this table i have milions of rows with random numbers in column sno
    i want to give the give the sequence numbers from 1 to 10000 in the sno column to the begining rows in the table
    (Oracle)
    could u post the code plese
    thanks & Regards
    Tangella

    Tangella wrote:
    Hi to all,
    i have a table (sample) with cplumns: sno, sname,dob and so on..........
    In this table i have milions of rows with random numbers in column sno
    i want to give the give the sequence numbers from 1 to 10000 in the sno column to the begining rows in the table
    (Oracle)
    could u post the code plese
    thanks & Regards
    TangellaHow do you define "the beginning rows in the table"? Rows in a relational, heap table have no "order" to them. There is no concept of "first".
    And once that is defined, why would you want to assign sequence number to only 10k our of "millions" of rows?

  • Assigning sequence numbers treo cords

    Please help to understand the following, because it's a little unclear for me.. can you provide me an example?
    So, regarding to assigning sequence numbers when a new record is created, we usually use a pre-insert trigger, with this code:
    SELECT orders_seq.NEXTVAL
    INTO :orders.order_id
    FROM SYS.dual;
    But:
    You can also assign sequence numbers from a table. If you use this method, two transactional
    triggers are usually involved:
    • Use Pre-Insert to select the next available number from the sequence table (locking the row
    to prevent other users from selecting the same value), assign it to the Forms item, and
    increment the value in the sequence table by the required amount.
    • Use Post-Insert to update the sequence table, recording the new upper value for the
    sequence.So how to assign a sequence number from a ... table?
    Thanks

    You have to implement the number generator yourself; something similar to this: http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4343369880986
    cheers

  • Temporary sequence numbers

    Hello all,
    Is there any provision in the mobile server and mobile client to synchronize the Lite database by using temporary sequence numbers for the newly added records?
    In the application that we are involved with, we are being asked to provide this behavior.
    In details we would ensure that the sequence generation works as it works for the desktop PCs as well.
    As far as we know we should follow the following steps for the synchronization:
    1. sync new rows with the server
    1a. the server syncs with the database, replaces temporary seqnos with the ones that come from the database
    2. sync the new seqnos back to the mobile device...
    Please let me know whether it is possible or not with the Oracle Lite system,
    Thanks in advance,
    Balazs

    do you have some need to keep the range of DONOR_ID sequential?
    In our implementation we use the other method that Greg has mentioned, defining sequences within the oracle lite publication itself
    We use sequence generated ID values as the primary key on a lot of our tables, and the columns are defined as NUMBER(12) (reasons are historical, and not necessarly for any good reason - but stuck with it)
    looking at the worst case scenario (to keep things simple) in the server we have table PLOTS. The highest ID value is around 5.5 million, with an annual growth rate of 500,000 for server created records. The number of records that would be created on any particular client on an annual basis is more like 2,000.
    When you define a sequence within the mobile server you specify a 'template' for each sequence consisting of
    name (eg: PLO_ID_SEQ)
    start value
    increment
    window (number of values to assign to a particular user)
    threshold (point at which the next set of values is sent to the user)
    for PLO_ID_SEQ, the start value is set at 500 million (overkill, but server generated id values will never reach this point in practice), increment is 1, window = 100,000 and threshold is 95,000
    This in practical terms means that the sequences on the clients will never need to be re-sent as the values will never reach the threshold, and there will never be any cross over with server generated sequences
    When you add your first client to the application, the actual sequence start value will be set for that client as 500,000,000. for the second user added it will be 500,100,000, for the third 500,200,000 etc.
    On the whole the mobile server manages this ok, but we have found that if there is a need to replace a client by rebuilding the database from scratch, occasionally it does not correctly maintain the last value used. To get around this we reset the user prior to the rebuild (this resets the sequence start for that user to the next range of values)
    This works ok, and is straightforward to implement as you need no code change/data manipulation on the server, but does result in the source of the records being obviously different (can be useful), and you cannot assume that the highest id value is the most recent record (can be a problem for reports)

  • Invoice Sequence Numbers

    Version : Oracle Apps 11.5.1 OS : HP-UX 64 bit.
    Module : Order Management.
    I want to generate unique sequence numbers for my shipment documents. For example, I have 2 customers A and B. I want my invoice numbers as A-001 for first customer, and A-002 for second customer and so on.
    How to generate such a sequence (alphanumeric). Any suggestions?
    TIA.

    Version : Oracle Apps 11.5.1 OS : HP-UX 64 bit.
    Module : Order Management.
    I want to generate unique sequence numbers for my shipment documents. For example, I have 2 customers A and B. I want my invoice numbers as A-001 for first customer, and A-002 for second customer and so on.
    How to generate such a sequence (alphanumeric). Any suggestions?
    TIA.

  • Exception when trying to update sequence numbers

    I'm using TopLink 9.0.4 with Weblogic 8.1 sp2, MS SQL Server 7.
    I am getting an exception when Toplink attempts to update a sequence number. The SQL it produces looks good, but for some reason, the method:
    oracle.toplink.internal.sequencing.SequencingManager$Preallocation_Accessor_Transaction_State.getNextValue()
    causes a rollback attempt. Here's the Exception in all its glory:
    Error Code: 0
         at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:226)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.rollbackTransaction(DatabaseAccessor.java:1398)
         at oracle.toplink.internal.sequencing.SequencingManager$Preallocation_Accessor_Transaction_State.getNextValue(SequencingManager.java:792)
         at oracle.toplink.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:325)
         at oracle.toplink.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:76)
         at oracle.toplink.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:127)
         at oracle.toplink.publicinterface.UnitOfWork.assignSequenceNumbers(UnitOfWork.java:347)
         at oracle.toplink.publicinterface.UnitOfWork.collectAndPrepareObjectsForCommit(UnitOfWork.java:636)
         at oracle.toplink.publicinterface.UnitOfWork.commitToDatabaseWithChangeSet(UnitOfWork.java:1099)
         at oracle.toplink.publicinterface.UnitOfWork.issueSQLbeforeCompletion(UnitOfWork.java:2438)
         at oracle.toplink.jts.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:151)
         at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1010)
         at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:115)
         at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1142)
         at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1868)
         at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:250)
         at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:221)
         at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:289)
         at com.taho.userManager.AdminUserFacade_lkmgk0_EOImpl.addSecurity(AdminUserFacade_lkmgk0_EOImpl.java:2503)
         at com.taho.userManager.AdminUserFacade_lkmgk0_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:87)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Very strange. I'm able to do other updates/inserts successfully when it doesn't involve sequence numbers.

    Wait - found it! Thanks for the help. I had my non-JTS data source erroneously configured to participate in global transactions.
    Thanks again for the help - this board is great!!

Maybe you are looking for