spring-data-r2dbc icon indicating copy to clipboard operation
spring-data-r2dbc copied to clipboard

Duplicate entry for key with ReactiveCrudRepository.save

Open lujijiang opened this issue 5 years ago • 2 comments

By default, the save() method inspects the identifier property of the given entity. If the identifier property is null, then the entity is assumed to be new. Otherwise, it is assumed exist in the datbase.

But got error:Duplicate entry for key,why?

lujijiang avatar Dec 25 '20 03:12 lujijiang

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal sample that reproduces the problem.

Please also verify your expectations against the Entity State detection strategies.

mp911de avatar Jan 08 '21 10:01 mp911de

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Jan 15 '21 10:01 spring-projects-issues

@GeneratedValue(strategy = GenerationType.IDENTITY) is a JPA annotation that isn't considered by R2DBC.

Please provide a minimal runnable sample that can reproduce your problem so we can investigate what is going on.

mp911de avatar Feb 23 '23 15:02 mp911de

With the code above, I'm not able to reproduce the issue, which is why I was asking for a reproducer. Without a way to reproduce the problem, this ticket isn't actionable.

mp911de avatar Feb 23 '23 15:02 mp911de