Oracle defines a sequence object that you can use to generate sequential
numbers. Oracle sequences are guarenteed to be transaction isolated in
such a way that the following script will hold true:
1. transaction A requests 'nextval' and gets 3
2. transaction B requests 'nextval' and gets 4
3. transactino A requests 'curval' and gets 3
4. transaction C requests 'nextval and gets 5
5. transaction B requests 'curval' and gets 4
and so on.
L. Yeung wrote:
> haven't experienced working on oracle dbs. can you
> shed some light?
>
> -L. Yeung
>
> From: Chris Tragas <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'"
> <[EMAIL PROTECTED]>
> Subject: RE: [JBoss-user] Auto-Incr
> Date: Mon, 9 Jul 2001 17:05:53 +1000
> Reply-To: [EMAIL PROTECTED]
>
> the disadvantages is a transactional one from a multi
> user perspective;
>
> a good way to model your increments is to immitate
> what oracle does
> with its
> sequence objects;
>
>
> Chris Tragas
> -----------------------------------------
> [EMAIL PROTECTED]
> -----------------------------------------
> www.atomicmedia.com
> -----------------------------------------
>
>
>
>
>
>>-----Original Message-----
>>From: Wei-ju Wu [mailto:[EMAIL PROTECTED]]
>>Sent: Monday, July 09, 2001 4:51 PM
>>To: [EMAIL PROTECTED]
>>Subject: Re: [JBoss-user] Auto-Incr
>>
>>
>>Could you please explain me the difference between
>>
> using an
>
>>AutoNumberBean and just doing a
>>
>>SELECT MAX(<id>) FROM <tablename> please ?
>>
>>I think these both approaches are similar and the
>>
> above
>
>>one is the one I use. Is there a performance
>>
> disadvantage
>
>>using a select max or can the database optimize the
>>access by using the index ? Or could there be
>>
> conflicts
>
>>with the CMP ?
>>
>>Wei-ju Wu
>>
>>
>>----- Original Message -----
>>From: "Devraj Mukherjee" <[EMAIL PROTECTED]>
>>To: <[EMAIL PROTECTED]>
>>Sent: Monday, July 09, 2001 8:34 AM
>>Subject: Re: [JBoss-user] Auto-Incr
>>
>>
>>
>>>Hi,
>>>
>>>I solved this problem by creating the table with a
>>>
> normal
>
>>integer as the
>>
>>>primary key and then writing a AutoNumberBean. The
>>>
>
>>AutoNumberBean is
>>
>>>another CMP bean which just keeps track of an
>>>
> Integer per
>
>>table. If you
>>
>>>want I can send you the code for it as well.
>>>
>>>Devraj
>>>
>>>At 23:15 8/07/01 -0700, you wrote:
>>>
>>>>i'm using mysql for my database and created an
>>>>auto-incrementing pk on a table. i wrote an
>>>>
> entity
>
>>>>bean which creates a row having a pk value of 0
>>>>"zero". mysql maps the value of 0 "zero" to the
>>>>last-pk-value + 1. however, when i retrieve my
>>>>
> data
>
>>>>through ejb, the pk still contains 0 "zero". im
>>>>
> using
>
>>>>jboss as my ejb-container. any help is gladly
>>>>appreciated.
>>>>
>>>>-L. Yeung
>>>>
>>>>
>>__________________________________________________
>>
>>>>Do You Yahoo!?
>>>>Get personalized email addresses from Yahoo! Mail
>>>>http://personal.mail.yahoo.com/
>>>>
>>>>_______________________________________________
>>>>JBoss-user mailing list
>>>>[EMAIL PROTECTED]
>>>>
>>http://lists.sourceforge.net/lists/listinfo/jboss-user
>>
>>>
>>>_______________________________________________
>>>JBoss-user mailing list
>>>[EMAIL PROTECTED]
>>>
>>>
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
>>
>>_______________________________________________
>>JBoss-user mailing list
>>[EMAIL PROTECTED]
>>
>>
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user