-
Notifications
You must be signed in to change notification settings - Fork 350
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
@CreatedDate doesn't work on one-to-many relationship #1607
Comments
Auditing columns are currently by design only supported for the aggregate root, since based on DDD there really is only one life cycle: that of the aggregate. Supporting auditing columns on inner entities of an aggregate would also be difficult since there really isn't a easy way of telling if those are new or modified without accessing the database for this. Leaving this open in order to have a short team discussion about it. |
Thanks for the prompt reply!
I was also thinking that this could be why it is not supported. However, I think there is a valid business requirement that we'd like to see who created what within the aggregate - in my case - who changed the address. When I think about it now, I'd like to differentiate between who touched the
I guess that the reason it works for the one-to-one relationship is some form of a side effect and not by design? For the sake of anyone else looking of a workaround to that. I've implemented a custom |
Strictly speaking it shouldn't work. Making it work could be considered a mistake. Although probably many wouldn't like me changing that now ... |
We discussed this internally. TL;DR: We'll leave it as it is. If we support auditing annotations on inner entities they really should get the same value, the aggregate root.
|
A reproducible example here.
When we save the Aggregate Root, the
@CreatedDate
annotated field is correctly set and saved on the aggregate root and on the one-to-one entity relationship. However, it fails to assign it on the one-to-many entity relationship.The text was updated successfully, but these errors were encountered: