I am developing an GWT application that uses Hibernate for data persistence on the server side. There are Objects like "Customers" with several attributes like Strings, Integers and Dates.
My problem is to get these objects to the Client to display them (and change/create them and send them to the server). But I always get serialization errors when trying to use my own Types. I read books, searched the internet, re开发者_JAVA技巧ad source code and tried out samples. I finally "converted" the attributes of my Objects into the fields of an ArrayList, but I think that can't be the way I should go.
I am currently using gwt-2.0.3 with Eclipse.
Looking forward to reading your suggestions!
This problem occurs because hibernate is using its own colections (PersistentSet and similar). You should use DTO pattern or use Gilead. I'd suggest Gilead (earlier known as hibernate4gwt), you have to configure it and your problem should be gone (read their documentation first to know what is the problem and how Gilead solves it).
If your problem is not related with lazy loading/collections, then your objects are not serializable. Make sure that your classes implement Serializable interface and have zero-argument constructors.
精彩评论