[ovirt-devel] hibernate's internal PersistentBag sent to FE

Tomas Jelinek tjelinek at redhat.com
Mon Jun 1 13:08:50 UTC 2015


Hey all,

since the org.ovirt.engine.core.common.job.Job/Step... has been moved to use the JPA we have a problem on frontend.
The problem is that the @OneToMany annotations results in a List which is of type PersistentBag. When we send this to
Frontend it fails during deserialization. It actually fails quite bad because the FE already has an ui-override of it which is not correct resulting in
a ton of NPEs in development mode.

So, there are 2 nasty fixes I have made where none of them should be merged but demonstrate the possibilities:
1: extend the FE to be able to work with the PersistentBag (https://gerrit.ovirt.org/#/c/41682/)
   not really good solution since the PersistenBag is an internal Hibernate class which is really not meant to be passed around

2: fix on the backend to not send the PersistentBag but an ArrayList. This is only a PoC fixed on a command we face the problem (https://gerrit.ovirt.org/#/c/41797/)
   Obviously this is not going to work for other commands accessing the same Job nor for other entities.

So, the first option is generic but very very bad. The second option should be used but not sure how to do this in a cheep way (e.g. without using reflection to deep traverse everything sent back to
frontend checking if it does not have a PersistentBag in it.

Any better ideas?
Thanx,
Tomas



More information about the Devel mailing list