0

I want to create a primary key of String type, which will be auto-generated by Spring JPA. I want that the primary key should start with "USER****" and it should be of uniform length. e.g. USER0012, USER0007, USER1409 etc. And also want each time next user id will get generate.

I am new to Spring JPA, I know we can generate long or int type of primary key with @GeneratedValue(strategy = GenerationType.IDENTITY) or @GeneratedValue(strategy = GenerationType.AUTO), but is there any inbuilt mechanism for this?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.