blob « JPA « JSF Q&A





1. JSF, Hibernate and serving a BLOB    stackoverflow.com

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    stackoverflow.com

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

    reportTemplate.setTemplatePath(inputFile.getFilename());
reportTemplate.setTemplateData(Hibernate.createBlob(byteArrayOutputStream.toByteArray()));
       ...