<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Guys,</div><div><br></div><div>Why is <a href="https://gerrit.ovirt.org/#/c/40804/">https://gerrit.ovirt.org/#/c/40804/</a> not enough? </div><div>Where do you get these errors?<br><br><br></div><div><br>On Jun 1, 2015, at 4:33 PM, Tomas Jelinek <<a href="mailto:tjelinek@redhat.com">tjelinek@redhat.com</a>> wrote:<br><br></div><blockquote type="cite"><div><span></span><br><span></span><br><span>----- Original Message -----</span><br><blockquote type="cite"><span>From: "Alexander Wels" <<a href="mailto:awels@redhat.com">awels@redhat.com</a>></span><br></blockquote><blockquote type="cite"><span>To: <a href="mailto:devel@ovirt.org">devel@ovirt.org</a></span><br></blockquote><blockquote type="cite"><span>Cc: "Tomas Jelinek" <<a href="mailto:tjelinek@redhat.com">tjelinek@redhat.com</a>>, "Liran Zelkha" <<a href="mailto:lzelkha@redhat.com">lzelkha@redhat.com</a>></span><br></blockquote><blockquote type="cite"><span>Sent: Monday, June 1, 2015 3:16:34 PM</span><br></blockquote><blockquote type="cite"><span>Subject: Re: [ovirt-devel] hibernate's internal PersistentBag sent to FE</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>On Monday, June 01, 2015 09:08:50 AM Tomas Jelinek wrote:</span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>Hey all,</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>since the org.ovirt.engine.core.common.job.Job/Step... has been moved to</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>use</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>the JPA we have a problem on frontend. The problem is that the @OneToMany</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>annotations results in a List which is of type PersistentBag. When we send</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>this to Frontend it fails during deserialization. It actually fails quite</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>bad because the FE already has an ui-override of it which is not correct</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>resulting in a ton of NPEs in development mode.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>So, there are 2 nasty fixes I have made where none of them should be merged</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>but demonstrate the possibilities: 1: extend the FE to be able to work with</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>the PersistentBag (<a href="https://gerrit.ovirt.org/#/c/41682/">https://gerrit.ovirt.org/#/c/41682/</a>) not really good</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>solution since the PersistenBag is an internal Hibernate class which is</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>really not meant to be passed around</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>2: fix on the backend to not send the PersistentBag but an ArrayList. This</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>is only a PoC fixed on a command we face the problem</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>(<a href="https://gerrit.ovirt.org/#/c/41797/">https://gerrit.ovirt.org/#/c/41797/</a>) Obviously this is not going to work</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>for other commands accessing the same Job nor for other entities.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>So, the first option is generic but very very bad. The second option should</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>be used but not sure how to do this in a cheep way (e.g. without using</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>reflection to deep traverse everything sent back to frontend checking if it</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>does not have a PersistentBag in it.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Tomas,</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Thanks, I was investigating the same issue, I noticed it last Friday just</span><br></blockquote><blockquote type="cite"><span>before leaving, so I was investigating the problem to see what was going on.</span><br></blockquote><blockquote type="cite"><span>You are right we should not be sending PersistentBag to the frontend at all.</span><br></blockquote><blockquote type="cite"><span>So how about we do a combination of [1] and [2], but instead of delegating in</span><br></blockquote><blockquote type="cite"><span>[1] we actually simple throw an exception stating don't sent PersistentBag to</span><br></blockquote><blockquote type="cite"><span>the front end. that way anyone inadvertently using it will be notified</span><br></blockquote><blockquote type="cite"><span>immediately (since their code won't work).</span><br></blockquote><span></span><br><span>Throwing the exception would help us in debugging but the main question is how will we make it work?</span><br><span>Since we are planning to move more and more to JPA so we will face this issue more and more often. </span><br><span>Solving it one by one on backend in each command is not going to work.</span><br><span></span><br><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Alexander</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>Any better ideas?</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Thanx,</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Tomas</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>_______________________________________________</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Devel mailing list</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span><a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span><a href="http://lists.ovirt.org/mailman/listinfo/devel">http://lists.ovirt.org/mailman/listinfo/devel</a></span><br></blockquote></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote></div></blockquote></body></html>