'Retrive Image from Database using Hibernate?

I need a code that can help me to retrieve my image/file from Mysql database and also display it on the webpage(.jsp) by using HIbernate and Servlet JSP. Q.How to Retrieve File/Image from Database And Display in JSP web page using Hibernate , MySQL Database?, Here's My Code...

`/**Employee and Login Registration*/

private void saveEmp(HttpServletRequest request, 
HttpServletResponse response) throws ServletException, IOException {        
    Employee emp = new Employee();  
    Part part = request.getPart("image");
    InputStream is = null;
    
    if(part != null) {
        is = part.getInputStream();
        byte[] data = new byte[is.available()];
        is.read();
        emp.setImage(data);     
                
    boolean status = MainServices.saveEmp(emp);
            if(status)
            {
                MainServices.saveLoginData(login);
                request.setAttribute("msg", "Form Submitted Successfully...");
                request.getRequestDispatcher("adminHome.jsp").include(request, response);
            }
            else
            {
                request.setAttribute("msg","Email or Mobile Number is already Registered with us....");
                request.getRequestDispatcher("empForm.jsp").include(request, response);
            }
        }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source