Skip to content

saveAll on null id's entities causing update statement #2064

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

Open
chrshnv opened this issue May 30, 2025 · 0 comments
Open

saveAll on null id's entities causing update statement #2064

chrshnv opened this issue May 30, 2025 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@chrshnv
Copy link

chrshnv commented May 30, 2025

saveAll on null id's entities causing update statement.

List<AppConfiguration> configurationsToSave = List.of(accessTokenConfiguration, refreshTokenConfiguration, expiredAtConfiguration);

configurationsToSave.forEach(it -> log.info(it.getId() != null ? it.getId().toString() : null));

appConfigurationRepository
		.saveAll(List.of(accessTokenConfiguration, refreshTokenConfiguration, expiredAtConfiguration));

logs with saveAll:

2025-05-30T11:30:41.694+05:00  INFO 11461 --- [chats] [nio-8080-exec-1] r.t.o.c.service.impl.BitrixTokenService  : null
2025-05-30T11:30:41.694+05:00  INFO 11461 --- [chats] [nio-8080-exec-1] r.t.o.c.service.impl.BitrixTokenService  : null
2025-05-30T11:30:41.694+05:00  INFO 11461 --- [chats] [nio-8080-exec-1] r.t.o.c.service.impl.BitrixTokenService  : null
2025-05-30T11:30:41.724+05:00 ERROR 11461 --- [chats] [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.data.relational.core.conversion.DbActionExecutionException: Failed to execute DbAction.UpdateRoot(entity=ru.trek.ozon.chats.domain.AppConfiguration@658327e7)] with root cause

org.springframework.dao.IncorrectUpdateSemanticsDataAccessException: Failed to update entity [ru.trek.ozon.chats.domain.AppConfiguration@658327e7]; Id [2f0a0c62-1a97-4ca4-a8ba-2c4b501e2459] not found in database```
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 30, 2025
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

No branches or pull requests

2 participants