Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002796 [Hessian] minor always 07-18-08 08:55 07-28-08 04:47
Reporter ferg View Status public  
Assigned To
Priority normal Resolution open Platform
Status new   OS
Projection none   OS Version
ETA none Fixed in Version Product Version
  Product Build
Summary 0002796: Hessian customization
Description (rep by Harald Radi)

i want to implement a custom serializer that overrules hessians default serialization implementation based on some custom annotations. I have the following usecase: I want to send JPA entities over the wire, but I don?t want the serializer to traverse all @ManyToOne mapped properties (and hence trigger a sql select) ? instead it should just serialize the id of those (the foreign key) which are available even without a further select. For that I annotated such fields with @SerializeById.
 
Now, trying to make the hessian serialization mechanism aware of this my naive approach would have been:
 
- add a custom SerializerFactory that provides a serializer for such annotated entities
- derive from JavaSerializer and overwrite getFieldSerializer and provide a different implementation for annotated fields
 
There are two difficulties with that approach:
 
- getFieldSerializer is private static, it needs to be protected for that
- only ?field.getType()? is passed to getFieldSerializer, to be able to access annotations the ?field? needs to be passed to it
 
 
This requires me to maintain a copy of the JavaSerializer class on my own, do you think that this is something that could be changed for the next release? The same applies to the deserializer of course.
 
Steps To Reproduce
Additional Information
Attached Files  JavaSerializer.java [^] (9,835 bytes) 07-28-08 04:43
 JavaDeserializer.java [^] (18,069 bytes) 07-28-08 04:44

- Relationships

- Notes
(0003285)
haraldradi
07-28-08 04:47

I attached the two files including the necessary modifications, sorry for not providing a diff.
 

- Issue History
Date Modified Username Field Change
07-18-08 08:55 ferg New Issue
07-28-08 04:42 haraldradi Issue Monitored: haraldradi
07-28-08 04:43 haraldradi File Added: JavaSerializer.java
07-28-08 04:44 haraldradi File Added: JavaDeserializer.java
07-28-08 04:47 haraldradi Note Added: 0003285


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker