Join an image into POJO on the server and then persisting using Hibernate?
in a question(here Placing an image in an object, sending the object over rpc and then using hibernate ), someone told me
- 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.
to be able to persist a file with hibernate.
I got an answer but I am not being able to know how to access the image on the server and join that with the hibernate object so that I can persist it on the database
There are two options:
store the file on disk and set its path in the entity
save the file in db (less preferable) in a blob. That would require setting a byte array in the entity
if you require more than one file per entity, you'd need a collection