Lazy Loading vs. Serialization

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Lazy Loading vs. Serialization

Florian Schätz-2
Hi,

we've encountered a strange behavior here: When we are using MyBatis, lazy loading works as expected, but as soon as the session (and with it, some objects with lazy loaded fields) is serialized, all lazy loaded fields are retrieved. Is this the expected behavior? Our only chance was to remove the lazy loading complete, since we are working in a cluster environment where the session is replicated. Of course we also could stop using MyBatis objects directly there, but that would mean duplication many objects formerly loaded via MyBatis with exact copies...

Regards,

Flo

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lazy Loading vs. Serialization

Iwao AVE!
Hi,

It is not the expected behavior.
Is it possible that one of the lazyLoadTriggerMethods [1] is invoked before serialization?

[1] The default methods are equals, clone, hashCode and toString.

Regards,
Iwao

2017-03-07 19:22 GMT+09:00 Florian Schätz <[hidden email]>:
Hi,

we've encountered a strange behavior here: When we are using MyBatis, lazy loading works as expected, but as soon as the session (and with it, some objects with lazy loaded fields) is serialized, all lazy loaded fields are retrieved. Is this the expected behavior? Our only chance was to remove the lazy loading complete, since we are working in a cluster environment where the session is replicated. Of course we also could stop using MyBatis objects directly there, but that would mean duplication many objects formerly loaded via MyBatis with exact copies...

Regards,

Flo

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lazy Loading vs. Serialization

Florian Schätz-2
Hello,

it is technically possible, but unfortunately, not by us, perhaps by the UI framework we are using (ZK). Thanks, perhaps I'll have to ask them.

Regards,

Flo

On Tuesday, March 7, 2017 at 1:30:18 PM UTC+1, Iwao AVE! wrote:
Hi,

It is not the expected behavior.
Is it possible that one of the lazyLoadTriggerMethods [1] is invoked before serialization?

[1] The default methods are equals, clone, hashCode and toString.

Regards,
Iwao

2017-03-07 19:22 GMT+09:00 Florian Schätz <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="WNvB7DSIEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">schaetz...@...>:
Hi,

we've encountered a strange behavior here: When we are using MyBatis, lazy loading works as expected, but as soon as the session (and with it, some objects with lazy loaded fields) is serialized, all lazy loaded fields are retrieved. Is this the expected behavior? Our only chance was to remove the lazy loading complete, since we are working in a cluster environment where the session is replicated. Of course we also could stop using MyBatis objects directly there, but that would mean duplication many objects formerly loaded via MyBatis with exact copies...

Regards,

Flo

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="WNvB7DSIEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...