Joined: Mon Jan 21, 2008 4:59 pm Posts: 10 Location: Ecuador
|
Hello.
I'm a begginer with Java and Hibernate. Have an important project for college. I hope somebody can help me. Thank you.
Hibernate version:3.2
Mapping document:
<property name="Image" column="IMAGE" type="binary" not-null="false" /> </property>
Code between sessionFactory.openSession() and session.close():
Session session = sessionFactory.getCurrentSession();
Blob result = null;
try {
session.beginTransaction();
Blob blob = (Blob) session.createSQLQuery("SELECT image as image FROM Imgsartic").addScalar("image").uniqueResult();
result = blob;
session.getTransaction().commit();
}
catch (Exception e) {
e.printStackTrace();
} return result;
Name and version of the database you are using:
Oracle Express 10g
JSP CODE:
<%
session.setAttribute( "ImgsArtic", revista.DAO.getImagen());
%>
<c:out value="${ImgsArtic}" />
Running the app shows next text:
org.hibernate.lob.SerializableBlob@135f92f
It seems corresponds to the "serial blob locator" I have reading these days from some people on forum.
I'm success working with clobs, but now with images and blobs I'm broken. The table has only 1 record. I don't know how to get and show the image on my jsp page.
Thank you very much for your time.
BM
|
|