-   Notifications  You must be signed in to change notification settings 
- Fork 131
Closed
Labels
type: enhancementA general enhancementA general enhancement
Milestone
Description
I have an entity bellow:
@Data @NoArgsConstructor @Table public class Role {	@Id	private Long id;	private String name;	@Version	private Long version = 0L;	public Role(String name) {	this.name = name;	} } And controller like this:
@RequestMapping("/api/role/save") public Mono<Role> save(@RequestBody Role role){	return roleRepo.save(role); } When I save a Role without @Version everything is fine
 But when I add @Version, it throws exception like this:
java.lang.IllegalArgumentException: Could not obtain required identifier from entity Role(id=null, name=ADMIN, version=0)!	at org.springframework.data.repository.core.EntityInformation.getRequiredId(EntityInformation.java:65) ~[spring-data-commons-2.2.0.M2.jar:2.2.0.M2]	at org.springframework.data.r2dbc.repository.support.SimpleR2dbcRepository.save(SimpleR2dbcRepository.java:72) ~[spring-data-r2dbc-1.0.0.M1.jar:1.0.0.M1]	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] Source code demo:
 https://github.com/roboticscm/r2dbc-reactive-redis.git
Cepr0, vuck3o, kingxsp, orange-buffalo, asakuma0401 and 1 more
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement