Skip to content

Accessing inherited @Id property fails #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mp911de opened this issue Apr 3, 2019 · 4 comments
Closed

Accessing inherited @Id property fails #87

mp911de opened this issue Apr 3, 2019 · 4 comments
Labels
type: bug A general bug
Milestone

Comments

@mp911de
Copy link
Member

mp911de commented Apr 3, 2019

@Getter
@Setter
@NoArgsConstructor
public class GenericEntity {
    @Id
    private Long id;

    @CreatedBy
    private Long createdBy;

    @CreatedDate
    private Long createdDate;

    @LastModifiedBy
    private Long updatedBy;

    @LastModifiedDate
    private Long updatedDate;

    @Version
    private Integer version = 0;
}

@Getter
@Setter
@NoArgsConstructor
public class Role extends GenericEntity {
    private String name;
    private String desc;
    private Integer sort;
}

Saving fails with:

java.lang.IllegalStateException: Required identifier property not found for class org.sky.entity.system.Role!
    at org.springframework.data.mapping.PersistentEntity.getRequiredIdProperty(PersistentEntity.java:105) ~[spring-data-commons-2.2.0.M2.jar:2.2.0.M2]
    at org.springframework.data.r2dbc.function.convert.MappingR2dbcConverter.lambda$populateIdIfNecessary$0(MappingR2dbcConverter.java:85) ~[spring-data-r2dbc-1.0.0.M1.jar:1.0.0.M1]

See https://stackoverflow.com/questions/55446827/are-there-mappedsuperclass-in-spring-reactive-data-r2dbc

@mp911de mp911de added the type: bug A general bug label Apr 3, 2019
@roboticscm
Copy link

It's not a bug, just remove @Version, it will work fine

@mp911de mp911de added this to the 1.0 M3 milestone May 22, 2019
mp911de added a commit that referenced this issue May 22, 2019
We now apply row metadata checks also for property population.
mp911de added a commit that referenced this issue May 22, 2019
Qualify field access with this.
@mp911de mp911de closed this as completed May 22, 2019
@joranb

This comment has been minimized.

@mp911de

This comment has been minimized.

@joranb

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants