TransactionalEventListener Transient

Hi,

I try to use TransactionalEventListener on entity who have a transient attribut.
In event when i join transaction my transient was null.

image

image

jmix_TransactionEvent.zip (303.5 KB)

gabriel

Whats wrong ?
You get entity from database by its id.
Database has no data for myTransient in your case as getMyTransient() not related to any stored entity attribute.

Thanks for your return,
that right, in cuba i use BeforeDetachEntityListener to populate specific transient that why we have it in listener.
But BeforeDetachEntityListener have no sense in Jmix in your case due to Lazy Loading,
So like BeforeDetachEntityListener, I will remove this listener

Peraphs you have a better candidate? a listener who permit to perform a centralized operation before commit with full entity

Maybe EntitySavingEvent will work for you?

1 Like