-
Notifications
You must be signed in to change notification settings - Fork 346
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
Primary key column is not included in insert SQL command #1530
Comments
Please use |
Hi @mp911de Thank you for the quick reply. If I use BeforeConvertCallback then error disappears. However I use BeforeConvertEvent then issue still reproduces:
|
Events aren't intended for updating the aggregate/entity as events can be multicasted on threads without synchronizing with the code paths that publish those events. Closing this one as the original issue is resolved. |
Sorry, but your statement contradicts documentation: Here's description of BeforeConvertEvent: Before an aggregate root gets converted into a plan for executing SQL statements, but after the decision was made if the aggregate is new or not, i.e. if an update or an insert is in order. This is the correct event if you want to set an id programmatically. |
Good catch. We should have updated the documentation about events. We fixed the docs via #1538. |
Hi
We have the following entity:
Here's database script to create this table:
CREATE TABLE ORDERS(id varchar(40) primary key, CREATED_AT timestamp, PRODUCT int);
So id is primary key but not auto-increment column. And we populate it using BeforeSaveCallback:
However resulting insert SQL doesn't contain id column and thus fail:
Spring Data JDBC: 3.1.0
The text was updated successfully, but these errors were encountered: