Ask Your Question
1

The JPA Repository.save() method is not working for the corresponding Entity due to the failure of the Non-PK automatic UUID that was created by Postgres during INSERT.

asked 2022-02-27 11:00:00 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-12-08 05:00:00 +0000

lalupa gravatar image

To solve this problem, you need to make sure that the UUID field in your entity is annotated properly with @GeneratedValue(strategy=GenerationType.AUTO). This will ensure that the UUID field is automatically generated by the database when the entity is persisted.

If this doesn't work, you may also need to check the type of the UUID field in your entity. It should be a java.util.UUID object, and not a String or any other data type.

If none of these solutions work, you may need to manually generate a UUID before persisting the entity, and set it to the UUID field. You can use the java.util.UUID class to generate a UUID.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-02-27 11:00:00 +0000

Seen: 9 times

Last updated: Dec 08 '21