JPA UUID PK issue while saving data from REST API
I am developing a extractor which invokes a REST service and saves the data into the database using JPA. The entities returned by the service uses UUID as the primary key. When I use the below mapping JAVA bean class for the id field, JPA assigns a new generated ID ignoring the ones which is coming from the service and this results in data duplication at my side. Can anyone advice on how to persist the UUIDs from service as PK in my database?
Mapping:
@SerializedName("name") @Column(length = 400) @Id @GeneratedValue(generator="system-uuid") @GenericGenerator(name="system-uuid", strategy = "uuid") private String name = null;