You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This results in an erroneous query being generated for the sub item. Here is a part of the resulting stacktrace (let's assume that the next value generated for the Base sequence was 5):
The repository then attempts to save the Sub entity, but fails, since the BeforeConvertCallback and the auditing logic are not invoked for it.
I'm not sure, whether the repository is intended to work like this at all (although the fact that it attempts to save the mapped entities certainly hints that it might have been intended), but this seems like an oversight. Or, perhaps, it was a structural issue on my part?
Thank you.
The text was updated successfully, but these errors were encountered:
Events and callbacks get only triggered for aggregate roots. If you want to process non-root entities, you need to do that through a listener for the containing aggregate root.
This design is based on the DDD practice not to access elements of an aggregate from outside the aggregate.
Assume the following classes (with Lombok
@Data
annotations):We also have a
BeforeConvertCallback
for each type, which gets the id from a PostgreSQL sequence.Let's consider a test example (in Groovy) for BaseRepository:
This results in an erroneous query being generated for the sub item. Here is a part of the resulting stacktrace (let's assume that the next value generated for the Base sequence was 5):
So, what I assume is happening here:
I'm not sure, whether the repository is intended to work like this at all (although the fact that it attempts to save the mapped entities certainly hints that it might have been intended), but this seems like an oversight. Or, perhaps, it was a structural issue on my part?
Thank you.
The text was updated successfully, but these errors were encountered: