Can I use System.nanoTime () as the primary key ID?

for stand-alone service, the primary key ID is a long integer, which needs to be non-continuous. For example, self-increment cannot be implemented because it is continuous.
I thought of using System.nanoTime () to do ID, because I haven"t practiced it. I wonder if there will be ID repetition?
the question is: 1 is this possible?

    2 
Mar.04,2021

No. NanoTime uses an uncertain start time and is likely to overlap after a restart.

you can use UUID.


Murphy's Law whenever it is possible to make a mistake, it is bound to go wrong, no matter how small the probability is.

cannot appear continuously, stand-alone service. For example, suppose you use self-increment ID to add System.nanoTime () to form a long type number ( is a string concatenation, not an addition ). This ID will not be repeated, because self-adding ID will not be repeated.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be8519-318c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be8519-318c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?