In my domain model, the "dto" classes are all Abstract and are subclassed into 
business objects which is what my application manipulates and persists. In 
hibernate terms I have a @MappedSuperclass and an @Entity subclass.

If I make the abstract class concrete, I can serialize it to GWT without any 
problem. However if I serialize the subclass, the result is garbage in GWT.

Specifically, my class has 2 int fields and a String. When I serialize the 
superclass, I correctly see a string value of "fred". However when I serialize 
the subclass and display the string contents it comes out as 
"java.lang.Integer/3438268394".

To track the problem down, I wiresharked the http traffic. First the good reply 
then the bad. 

0000  2f 2f 4f 4b 5b 31 32 33 2c 31 32 33 34 35 36 2c   //OK[123,123456,
0010  33 2c 32 2c 31 2c 5b 22 63 6f 75 6b 2e 63 6c 65   3,2,1,["couk.cle
0020  76 65 72 74 68 69 6e 6b 69 6e 67 2e 74 6c 32 30   verthinking.tl20
0030  31 30 2e 73 68 61 72 65 64 2e 47 77 74 2f 31 34   10.shared.Gwt/14
0040  32 35 33 37 38 35 37 22 2c 22 63 68 61 72 22 2c   2537857","fred",
0050  22 6a 61 76 61 2e 6c 61 6e 67 2e 49 6e 74 65 67   "java.lang.Integ
0060  65 72 2f 33 34 33 38 32 36 38 33 39 34 22 5d 2c   er/3438268394"],
0070  30 2c 35 5d                                       0,5]


0000  2f 2f 4f 4b 5b 31 32 33 2c 31 32 33 34 35 36 2c   //OK[123,123456,
0010  33 2c 32 2c 31 2c 5b 22 63 6f 75 6b 2e 63 6c 65   3,2,1,["couk.cle
0020  76 65 72 74 68 69 6e 6b 69 6e 67 2e 74 6c 32 30   verthinking.tl20
0030  31 30 2e 73 68 61 72 65 64 2e 47 77 74 2f 31 36   10.shared.Gwt/16
0040  33 32 35 31 30 37 30 37 22 2c 22 63 68 61 72 22   32510707","fred"
0050  2c 22 6a 61 76 61 2e 6c 61 6e 67 2e 49 6e 74 65   ,"java.lang.Inte
0060  67 65 72 2f 33 34 33 38 32 36 38 33 39 34 22 5d   ger/3438268394"]
0070  2c 30 2c 35 5d                                    ,0,5]

The bad reply (the sub-class) seems to be one byte longer. Is this enough to 
confuse the parser at the client?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2622588

Reply via email to