Skip to content

DATAJDBC-557 - Save entity only have id and collections throws exception. #224

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
wants to merge 2 commits into from

Conversation

lseeker
Copy link
Contributor

@lseeker lseeker commented May 27, 2020

DATAJDBC-557

Entity like

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

generates invalid sql on InsertRoot and UpdateRoot.

This pull request fixes by include id column when no columns exists on aggregate root.

@lseeker lseeker force-pushed the issue/DATAJDBC-557 branch from 29ec66a to fc5f6d7 Compare June 16, 2020 13:12
Copy link
Contributor

@schauder schauder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work so easy.

At least some databases don't allow to provide null for a generated field, e.g. Postgress will try to write the null value actually to the database. DEFAULT probably does the trick there. See https://stackoverflow.com/a/12836448/66686

Therefore I guess we need to extend the dialect to provide information how to handle this case and then act accordingly when performing inserts/updates.

I rebased the current PR and pushed it as https://github.com/spring-projects/spring-data-jdbc/tree/pr/datajdbc-557

See https://github.com/spring-projects/spring-data-jdbc/tree/pr/datajdbc-557#running-integration-tests for how to run integration tests locally.

@schauder
Copy link
Contributor

As mentioned in the previous comment, the current approach does not work.

@schauder schauder closed this Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants