R2DBC Entity Callback – AfterConvert:
Lets implement the other requirement – to apply seasonal global discounts to all products when we select records from DB. Here we do not want to touch the database. We still want to keep the original price as it is. We just want to update the price once it is retrieved from DB.
AfterConvertCallback hook would be a good choice here.
\BeforeConvertCallback. In this case our implementation should implement Ordered as well as shown here to return the order in which it should be executed.
R2DBC Entity Callback – BeforeSave:
Sometimes the actual table might have more columns and entity object might not contain all the fields. For ex: fields like created_by, created_date etc. But we might want to update these fields. In this case, BeforeConvertCallback will not help much! But we could achieve with BeforeSaveCallback.
No comments:
Post a Comment