How to Handle Partially Loaded Bean after Serialisation #3410
Replies: 3 comments 4 replies
-
There is API to set the BeanLoader. I believe for this case the app will need to explicitly set the BeanLoader after deserialisation. |
Beta Was this translation helpful? Give feedback.
-
An additional question if I may. Do you know if there are other situations similar to this where the underlying ebean process try to default to the registered databases that I need to watch out for? This is given that
I have been reviewing usages of the functionalities that retrieves the registered database(s) in Thank you very much for your help. |
Beta Was this translation helpful? Give feedback.
-
As I see it the ideal is that entity beans that we use serialisation/deserialisation are actually fully read only and immutable and we are working towards this with Ebean. You may note we have "Application Cache of entity bean graphs that are Immutable and Read Only" These are graphs in that they can include related entities via *ToOne and *ToMany. Perhaps the thing of note here is that the existing L2 cache works on a "data basis" caching the underlying data, and this "Application Cache" will actually work on a entity bean graph basis / actual entity beans (and we want to support serialisation/deserialisation for this application cache). I'd be keen to hear about your use case for serialisation/deserialisation. I'd be interested to know if it has overlap with the "Application Cache" concept that is work-in-progress. Edit: As I see it, if we do this "Application Cache" well then for many folks it could replace the use of the existing L2 cache mechanism. To some extent it will be simpler but with strong requirements for being Immutable and Read-Only (unlike the L2 cache which does not have those limitations). |
Beta Was this translation helpful? Give feedback.
-
Hi @rbygrave @rob-bygrave ,
I have a use case I hope you could give me some guidance with. My use case is:
Database
on creation because I already use injection to manage these instances.PersistenceException
inInterceptReadWrite.loadBean
becausebeanLoader
isnull
and I have no database registered.beanLoader
is present. However, being atransient
field,beanLoader
did not survive the serialisation/deserialisation.Can I please ask what is ebean guidelines in handling situations such as this?
Database
instances via injection, there is no need to register but I might have been mistaken here.Database
instances, is there some steps I'm missing to restore thebeanLoader
property upon deserialising the bean?Thank you very much for your time and assistance.
Beta Was this translation helpful? Give feedback.
All reactions