blob « JPA « JSF Q&A

1. JSF, Hibernate and serving a BLOB

I want to serve an image saved as a blob in a MySQL Database through hibernate3 in a JSF application. My intention is that /myapp/image/get.faces?id=x will serve the image saved in ...

2. entity manager merge method to update blob field

public void uploadFile(ActionEvent evt)throws Exception{
InputFile inputFile=(InputFile)evt.getSource();
    byteArrayOutputStream=new ByteArrayOutputStream();
    ObjectOutputStream objectOutputStream=new ObjectOutputStream(byteArrayOutputStream);