Java Hibernate Id Question

Is there any way I could generate a four digit number from the AutoGenerated Id that the entity creates?
For example: Person has a unique #1. And I would like to create another number that looks like 1001.
Person #130 would be 1130. I don’t think my table is going to be over 9999.

Any help would be greatly appreciated.
Thanks in advance,
Nick

Answer

Use a sequence generator and make the sequence start at 1000.

Leave a Reply

Your email address will not be published. Required fields are marked *