Community
Participate
Working Groups
HI everyone. I tried to persist a WritableSet with hibernate today and found its not serializable. Wouldn't it be Handy if these classes were all serializable ? Regards Thomas
Would you be interested in submitting a patch, ideally together with a test case that confirms serializability?
I'll have a look at it today.
Hello Boris, I'm not really happy now I had a look at it. I started off with making IObservableCollection Serializable, added all the required UIDs etc. then I had a look at what to serialize an what could be transient and reconstructed after deserialization. I wrote a simple Test for an JavaBeansObservableList to get started. The problem here is that JBOList holds a PropertyDescriptor which is needed and is not serializable. I can make the Realm and the ChangeSupport transient, but I have no idea what to do with the descriptor. Any ideas ?
This brings us back to the start - I can see how a WritableList/Set could be made serializable. But why would you make a JavaBeansObservableList/Set serializable? I don't know much about Hibernate, but isn't it used to put things into a relational database? Why would you serialize objects rather than mapping them to the appropriate columns and rows in your database?
Its not that big a problem as I can workaround with a single line of code. Just thought it would be nice. All my domain objects are JavaBeans. So I use them through all layers of the application. I have a server process with hibernate that exposes RMI services to the client. Was a little tricky to make hibernate work with the JavaBeans but now it works. So what I do is Edit a JavaBean with An eclipse client and happily with databinding. I send it over the line via good old RMI and the Server process persists it in the database. The client doenst fiddle with hibernate. So it just came to the point where I had indeed a WritableList in my domain object which couldnt be sent over the line. Maybe I wanted too much when I started with making IObservableCollection my starting point ? :) I just found out that I have different troubles when I serialize them as the server has to know the classes then too (which it doesnt right now). Its just for the sake that I can use the same domain objects in the server that I use in the client, as converting business domain objects is a really stupid task. I liked this with JSF and Seam.
Ok I now made WriteableList/Set only serializable. I had to introduce a default constructor in the non serializable superclasses. Please have a look at it its no big deal.
Created attachment 75904 [details] WriteableList
Created attachment 75905 [details] ObervableList
Created attachment 75906 [details] WritableSet
Created attachment 75907 [details] ObervableSet
Created attachment 75908 [details] SerializableTest
Thomas, could you please post a combined attachment with all changes, in patch format? To do this, check out the required projects from CVS, make the changes, and then select all changed projects, right-click, "Team > Create Patch...", and use the default options when creating the patch.
Created attachment 75918 [details] Combined Patch
Hope this works :)
ok for me
Changing to WONTFIX since we didn't do anything. Can you share with us why you don't need this anymore?
Hello, I just found this bug, since I have the same problem with serializing of a WritableList. I have to transfer objects containing WritableLists over DnD and over a network. As I understand Thomas patch worked for him so why wasn't this integrated? Regards Veselin
I guess it would benefit a lot of people if databinding API became serializable. In my case I'm using databinding with RAP project which works great. However you soon end up having observables that you need to serialize to be able to put them safely in your session attributes. Also I'm not sure to understand from the bug history why it was changed to WONTFIX. Could someone clarify what was the rational behind the wontfix status?
I don't see any reason why this patch shouldn't be applied. I think Boris did not apply the patch because of some confusion over the meaning of comment 15. It does seem odd to be serializing an observable because you can't really listen for changes in the collection that arrive remotely if you are replacing the observable. However I can see situations where it would be beneficial to allow serialization. Databinding work is now being done in the e4 repository so I'll get it checked in there once I have finished other pending commits.