I want generate unique ID just like auto increment in java . So previously i used current nano seconds but i end up with clash since two data comes with in same nano second
While the UUIDs are not guaranteed to be unique, the probability of a duplicate is extremely low. See Random UUID probability of duplicates.
For your application, it makes sense to use the UUID, but you may want to deal with the extremely rare condition, just in case.