Skip to content

Cannot save entity only have id and collections [DATAJDBC-557] #777

Closed
@spring-projects-issues

Description

@spring-projects-issues

lseeker opened DATAJDBC-557 and commented

Exception on save entity have only ID property and collections like this.

class DummyEntity {
	@Id private Long id;
	Set<Element> content = new HashSet<>();
}

Repository.save() generates bad SQL and throws exception.

On insert:

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO "DUMMY_ENTITY" VALUES ()]; nested exception is java.sql.SQLSyntaxErrorException: unexpected token: )

and on update:

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [UPDATE "DUMMY_ENTITY" WHERE "DUMMY_ENTITY"."ID" = ?]; nested exception is java.sql.SQLSyntaxErrorException: unexpected token: WHERE required: SET

Affects: 2.0 GA (Neumann), 2.1 M1 (2020.0.0)

Referenced from: pull request #224

Metadata

Metadata

Assignees

Labels

in: coreIssues in core supporttype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions