I am using gwt rpc and hibernate on the back end. I have an object in which one of the field is an image. I have to place the image in the object, send the file over rpc and saving it back to database using hibernate.
Does anyone of you have an idea about this??
It can't be done exactly as described. In javascript, you can't capture the binary contents of a file into the javascript VM. You have to use file upload to send it to the server. Your flow needs to be something like:
- Capture non-binary fields (text) into the POJO. I.e. a form.
- Transfer the object using GWT RPC to the server.
- Upload image to server.
- Join the image into the POJO on the server.
- Save to database.
The image field needs to be annotated @GwtTransient
to be transient in GWT, not transferred in the ajax requests, but still persisted by hibernate.