Skip to content

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

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
spring-projects-issues opened this issue May 27, 2020 · 1 comment
Assignees
Labels
in: core Issues in core support type: bug A general bug

Comments

@spring-projects-issues
Copy link

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

@spring-projects-issues spring-projects-issues added type: bug A general bug in: core Issues in core support labels Dec 31, 2020
schauder added a commit that referenced this issue Nov 29, 2021
Simplified the code structure.
Ensured backward compatibility by recreating some methods often immediately deprecating them.

See #777
schauder added a commit that referenced this issue Nov 29, 2021
Moved SelectRenderContext and InsertRenderContext to dialect.
Moved RenderContextFactory to render.

See #777
schauder added a commit that referenced this issue Dec 1, 2021
Simplified the code structure.
Ensured backward compatibility by recreating some methods often immediately deprecating them.

Moved new classes to the places where they belong, so that the package ...core.sql.render depends on ...core.dialect and not the other way round.
This causes dependency cycles because dependencies in the other direction already exists.
This will be properly fixed by #1105.
For now the offending classes are ignored by the DependencyTests.

See #777
See #1105

Polishing
schauder added a commit that referenced this issue Dec 1, 2021
@schauder
Copy link
Contributor

schauder commented Dec 1, 2021

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
Labels
in: core Issues in core support type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants