Bug 199476 - [DataBinding] Classes should be serializable
Summary: [DataBinding] Classes should be serializable
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC All
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-08-09 16:11 EDT by Thomas Kratz CLA
Modified: 2013-06-05 10:38 EDT (History)
5 users (show)

See Also:


Attachments
WriteableList (6.37 KB, patch)
2007-08-11 11:51 EDT, Thomas Kratz CLA
no flags Details | Diff
ObervableList (7.42 KB, text/plain)
2007-08-11 11:53 EDT, Thomas Kratz CLA
no flags Details
WritableSet (4.38 KB, patch)
2007-08-11 11:54 EDT, Thomas Kratz CLA
no flags Details | Diff
ObervableSet (5.08 KB, text/plain)
2007-08-11 11:54 EDT, Thomas Kratz CLA
no flags Details
SerializableTest (2.43 KB, text/plain)
2007-08-11 11:55 EDT, Thomas Kratz CLA
no flags Details
Combined Patch (20.03 KB, patch)
2007-08-12 05:42 EDT, Thomas Kratz CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Kratz CLA 2007-08-09 16:11:21 EDT
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
Comment 1 Boris Bokowski CLA 2007-08-10 11:35:59 EDT
Would you be interested in submitting a patch, ideally together with a test case that confirms serializability?
Comment 2 Thomas Kratz CLA 2007-08-11 06:18:18 EDT
I'll have a look at it today.
Comment 3 Thomas Kratz CLA 2007-08-11 08:27:05 EDT
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 ? 
Comment 4 Boris Bokowski CLA 2007-08-11 10:13:46 EDT
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?
Comment 5 Thomas Kratz CLA 2007-08-11 10:27:14 EDT
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.
Comment 6 Thomas Kratz CLA 2007-08-11 11:50:58 EDT
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.
Comment 7 Thomas Kratz CLA 2007-08-11 11:51:58 EDT
Created attachment 75904 [details]
WriteableList
Comment 8 Thomas Kratz CLA 2007-08-11 11:53:27 EDT
Created attachment 75905 [details]
ObervableList
Comment 9 Thomas Kratz CLA 2007-08-11 11:54:06 EDT
Created attachment 75906 [details]
WritableSet
Comment 10 Thomas Kratz CLA 2007-08-11 11:54:39 EDT
Created attachment 75907 [details]
ObervableSet
Comment 11 Thomas Kratz CLA 2007-08-11 11:55:28 EDT
Created attachment 75908 [details]
SerializableTest
Comment 12 Boris Bokowski CLA 2007-08-12 00:32:34 EDT
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.
Comment 13 Thomas Kratz CLA 2007-08-12 05:42:26 EDT
Created attachment 75918 [details]
Combined Patch
Comment 14 Thomas Kratz CLA 2007-08-12 05:42:54 EDT
Hope this works :)
Comment 15 Thomas Kratz CLA 2007-12-20 14:38:20 EST
ok for me
Comment 16 Boris Bokowski CLA 2007-12-20 15:06:10 EST
Changing to WONTFIX since we didn't do anything.

Can you share with us why you don't need this anymore?
Comment 17 Veselin Markov CLA 2012-10-04 06:04:36 EDT
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
Comment 18 Sebastien Arod CLA 2013-04-02 06:22:02 EDT
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?
Comment 19 Nigel Westbury CLA 2013-04-11 17:29:30 EDT
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.