Generating unique IDs When identifiers are used solely within a database, their generation should be left to the database itself. (See .) Unique identifiers which are "published" in some way may need special treatment, since the identifier may need to be difficult to guess or forge. A typical example is the value of a cookie used as a session identifier - simply using a series of consecutive integers is generally unacceptable, since one user could easily impersonate another by altering the value of the cookie to some nearby integer. Style 1 - UUID Example Example run: >java -cp .
Read full article from Java Practices -> Generating unique IDs
No comments:
Post a Comment