Unique number generation with Java Server Faces

Posted by Buddhika Ariyaratne on Stack Overflow See other posts from Stack Overflow or by Buddhika Ariyaratne
Published on 2012-11-15T00:18:11Z Indexed on 2012/11/16 11:01 UTC
Read the original article Hit count: 232

Filed under:
|

I am developing an application for a medical channelling centre where multiple users reserve bookings for doctors with JSF and JPA. A sequence number is unique to the Doctor, Date and Session. I tried to get a unique sequence number from counting the previous bookings and add one, but if two requests comes at the same time, two bookings get the same number causing trouble to functionality. How can I get unique number in this case? Can I use an application wide bean to generate it? (I thought it is not practicle to get the unique number from the database sequence number as there are several doctors, sessions and daily they have to have different booking number.)

© Stack Overflow or respective owner

Related posts about jsf

Related posts about java-ee