Hi,
when I store an entity A in the databes, I need to record some manual sql statements in a parallel table (not cuba table, complete different one)… so what I do is, via an A entity listener, call to the method in charge of traversing the A entity and storing the data manually…
I have however an entity B which is related to A in a O-t-M fashion. Surprisingly if I debug the A entity instance in the onAfterInsert() method in the A entitylistener, the A entity comes in without it’s B related records being populated… although the records/instances of B are there when storing the A instance. So apparently, the A instance coming in the entitylistener comes without O-t-M related entities.
I have tried reloading through Persistence/DataManager, but no luck, the entity is not there, nor I have access to the entity, hence not being able to be compliant with the data I need to write in my additional table.
I presume the original recording transaction is not over and therefore the instance is not in the DB to be reloaded. Then I need a way to call the method once the Transaction if fully completed. Or are there any other solutions? I can attach manually
Any help is greatly appreciated.
Regards,
Carlos.