<h:graphicImage> and MySQL BLOB
843842Apr 16 2004 — edited Apr 27 2006I have a MySQL database which uses BLOB's to store user-supplied pictures, and would like to use the <h:graphicImage> tag to display the pictures on a JSP page. The problem is that simply parsing the BLOB data to a java.sql.Blob object within a bean and then going:
<h:graphicImage id="userpic"
alt="userpic"
value="#{MyBean.picture}">
</h:graphicImage>
causes a ClassCastException. Does anybody know how to get around this, or if it's even possible for me to do what I'm trying to do? Do I need to parse the Blob data into some other class (like a BufferedImage or something) in order to make it work?