hibernate BlobフィールドOutOfMemoryErrorを読み込む


データベース:mysql server 6.0
driver:mysql-connect-java-5.0.4-bin.jar
Hibernate:3.2
mysql userテーブルのBLOBフィールドを読み、java.lang.OutOfMemoryError:Java heap spaceというエラーが発生しました.
次は私のコードです.
Userクラス:

package org.redleaf;

import java.sql.Blob;

public class User {

	private int id ;
	private String name ;
	private Blob details ;
	
	public Blob getDetails() {
		return details;
	}
	public void setDetails(Blob details) {
		this.details = details;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	
}


user.hbm.xmlファイル:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
    <class name="org.redleaf.User" table="user"> 
       <id name="id" column="id">
          <generator class="native" />
       </id>
       <property name="name" column="name" />
       <property name="details" column="details" type="java.sql.Blob" lazy="true"/>
    </class>
</hibernate-mapping>

ダウンロードしたservletプログラム:
package org.redleaf.util;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class download extends HttpServlet {

	public download() {
		super();
	}

	public void destroy() {
		super.destroy(); 
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		org.hibernate.cfg.Configuration conf = new org.hibernate.cfg.Configuration().configure("/workspace.cfg.xml");
		org.hibernate.SessionFactory sessionFactory = conf.buildSessionFactory();
		org.hibernate.Session se = sessionFactory.openSession();
		org.redleaf.User user = (org.redleaf.User)se.get(org.redleaf.User.class, new Integer(4));//         ,  details         
		
		String display_name = "test  .chm";  //         details  , 33MB
		
		response.setHeader("Content-disposition","attachment;filename=" + new String(display_name.getBytes("gbk"),"iso8859-1"));
		
		BufferedInputStream input = null;
		BufferedOutputStream output = null;
		try{
		
				java.sql.Blob details = user.getDetails();

			
				java.io.InputStream in = details.getBinaryStream(); 
			
			    input = new BufferedInputStream(in);
			    output = new BufferedOutputStream(response.getOutputStream());
			    int len = 0;
			    byte [] b = new byte[10240];
			    while((len = input.read(b)) != -1){
		    	    	output.write(b,0,len);
			    }


		}catch(Exception e){ 
		    e.printStackTrace();
		}finally{
			if(output!=null) output.close();
		    if(input!=null) input.close();
		}
		
		
		/*
		OutputStream out = response.getOutputStream();
		try{
			
			out.write(user.getDetails().getBytes(1,(int) user.getDetails().length()));
        
      
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			  out.flush();
		      out.close();
		}
		*/
	}

	public void init() throws ServletException {

	}

}

このdetailsフィールドをデータベースから読み込めない方法を見てくださいjava.lang.OutOfMemoryError:Java heap spaceというエラー