I am fixing errors (problems with threads) in java code that generate barcodes. By design, the barcode is simply a number, and the next barcode is "not used", the next in sequence. There are 99 billion possible numbers.
First of all, I don't like automatic extensions because of security concerns. I want to generate random numbers.
Already used barcodes are stored in the database table.
It is very simple to create a random number and check the table if a barcode is used. But the logic will have to go in cycles until it finds a random number that is not used. Over time, this can be a daunting task.
I think a secure cache with 1000 free barcodes would do the job, but creating or updating a cache can be quite difficult.
Any suggestions for a query design that does a search, or a query that can return a range of free random numbers?
I use hibernation criteria.
thanks
java multithreading database
Peter Villadsen
source share