Skip to content

More clear error message when select entities with Builder but no default constructors [DATAJDBC-298] #523

@spring-projects-issues

Description

@spring-projects-issues

Yuxin Bai opened DATAJDBC-298 and commented

This is a many-to-many relationship that use IDs in a reference table to link two entities, Mirror and MirrorRequester. One of the entities MirrorRequester has a Set to represent one-to-many relationship with the reference table MirrorReference.

We are using Lombok @Builder in our codebase. When we do findAll() on MirrorRequester, we are getting this error: java.lang.IllegalStateException: Required identifier property not found for class com.sample.springdatajdbcschema.MirrorReference!.

This error goes away when we add @NoArgsConstructor(needed by spring-data-jdbc I assume) and @AllArgsConstructor(needed by lombok builder) to MirrorRequester alongside with @Builder.

 

Sample project here: https://github.com/LittleBaiBai/spring-data-jdbc-sample

Instead of adding lombok to the dependencies, I used the generated code in the sample project.

There are two commits, first one is the failing test commit without default constructor, and second one is passing with default constructor. 


Reference URL: https://github.com/LittleBaiBai/spring-data-jdbc-sample

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions