Skip to content

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

Closed

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

Activity

  1. added
    type: bug
    in: core
    on Dec 31, 2020
  2. added 3 commits that reference this issue on Nov 29, 2021
    7551cbd
    770e090
    f32d152
  3. schauder commented on Dec 1, 2021

    @schauder
    Contributor

    Thanks for your work.

    I polished and merged it.
    It turned out that your dependency problems you encountered from dependencies going in the wrong direction in the first place. Fixing those requires breaking changes and therefore will happen for 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions