Please validate my conclustion: - I will create a record in *SequenceValueItem* table with seqName 'mrNbr' for example.
- When I create new patient, in the same service I will get seqId and will put this value as patientNbr (or mrNbr) in my table and will add 1 in seqId. - I will update *SequenceValueItem *and my table (patient records) and in the same time if someone else is trying to update *SequenceValueItem *table with the same seqId, it will through an exception because of pessimistic locking. Thank you Muhammad Aamir On Sat, Apr 25, 2009 at 3:52 AM, BJ Freeman <[email protected]> wrote: > So is there any thoughts against adding a parm to enforce the sequential > numbering where it will not jump numbers? > > David E Jones sent the following on 4/24/2009 3:16 AM: > > > > The problem is that this code is meant for performance and throws away > > sequence values all the time. For example, it gets banks of 10 numbers > > at a time and if not used are thrown away. Also, this runs in a separate > > transaction to be non-blocking and has collision detection to avoid > > mishaps, and if a collision is detected then the whole bank attempted > > will be thrown away. > > > > -David > > > > > > On Apr 23, 2009, at 9:41 PM, BJ Freeman wrote: > > > >> My understanding was that he wanted to have an Id for medical records > >> since nothing else would use that sequence name it would be sequencel > >> staggerMax is set to 1 by default > >> public String getNextSeqId(String seqName) { > >> return this.getNextSeqId(seqName, 1); > >> } > >> now if you call > >> public String getNextSeqId(String seqName, long staggerMax) { > >> Long nextSeqLong = this.getNextSeqIdLong(seqName, staggerMax); > >> > >> if (nextSeqLong == null) { > >> // NOTE: the getNextSeqIdLong method SHOULD throw a runtime > >> exception when no sequence value is found, which means we should never > >> see it get here > >> throw new IllegalArgumentException("Could not get next > >> sequenced ID for sequence name: " + seqName); > >> } > >> > >> if > >> (UtilValidate.isNotEmpty(this.getDelegatorInfo().sequencedIdPrefix)) { > >> return this.getDelegatorInfo().sequencedIdPrefix + > >> nextSeqLong.toString(); > >> } else { > >> return nextSeqLong.toString(); > >> } > >> } > >> > >> then it would be staggered. this is not defualt > >> > >> or have I missed something. > >> > >> > >> David E Jones sent the following on 4/23/2009 8:21 PM: > >>> > >>> When you look at the code you'll find it most certainly will skip, in > >>> fact the default sequencing is designed for skipping to be okay in > order > >>> to perform better. > >>> > >>> If you want a more strict sequence then take a look at the invoiceId > >>> generation in the createInvoice service. It is configurable and some of > >>> the options are meant to make things sequential. Be aware though that > >>> because of the way transactions work by default (ie the transaction > >>> isolation done), depending on the transaction isolation it can be > >>> possible for skips to happen (ie because of phantom reads, etc), it's > >>> just not as likely. > >>> > >>> -David > >>> > >>> > >>> On Apr 23, 2009, at 6:16 PM, BJ Freeman wrote: > >>> > >>>> suggest you look at the code to make you confident. > >>>> > >>>> Muhammad Aamir sent the following on 4/23/2009 5:06 PM: > >>>>> And sure it will never skip (as well as repeate)? > >>>>> > >>>>> Thanks > >>>>> > >>>>> On Fri, Apr 24, 2009 at 2:34 AM, BJ Freeman <[email protected]> > >>>>> wrote: > >>>>> > >>>>>> look at the > >>>>>> > >>>>>> > https://demo.ofbiz.org/webtools/control/FindGeneric?entityName=SequenceValueItem&find=true&VIEW_SIZE=50&VIEW_INDEX=0 > >>>>>> > >>>>>> > >>>>>> you can define your own sequence name > >>>>>> > >>>>>> delegator.getNextSeqId uses this > >>>>>> > >>>>>> > >>>>>> Muhammad Aamir sent the following on 4/23/2009 4:18 PM: > >>>>>>> I am working on an Outpatient Management module for a clinic. > >>>>>>> I've to > >>>>>> extend > >>>>>>> Person entity adding mrNbr (medical record number) field. The field > >>>>>> should > >>>>>>> keep incremented automatically and must not repeat and preferably > >>>>>>> not > >>>>>> skip > >>>>>>> as well. > >>>>>>> > >>>>>>> Can anybody give me a clue on it (I tried in documentation pages > but > >>>>>> didn't > >>>>>>> get any hint). > >>>>>>> > >>>>>>> Also, is there any page where all entity field data types of ofbiz > >>>>>>> entity > >>>>>>> engine are explained? > >>>>>>> > >>>>>>> Thanks > >>>>>>> Muhammad Aamir > >>>>>>> > >>>>>> > >>>>> > >>>> > >>> > >>> > >> > >> -- > >> BJ Freeman > >> http://www.businessesnetwork.com/automation > >> http://bjfreeman.elance.com > >> Systems Integrator. > >> > > > > > > -- > BJ Freeman > http://www.businessesnetwork.com/automation > http://bjfreeman.elance.com > > http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro > Systems Integrator. > >
