Hi you can achieve this by creating a CustomIdGenerator annotation.
You can take a reference from my personal project regarding custom annotations...
Reference link Custom Annotation (customerdata)