Вы должны использовать сервлет в качестве механизма загрузки.
Отправьте свою форму сервлету, используя Get или Post, затем в классе Servlet реализуйте doGet или doPost соответственно.
Используя Hibernate, извлекаем столбец как байтовый массив.
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
//Getting data s byte Array;
byte[] csvFile = daoService.getFile(id);
resp.setContentType("text/csv");
resp.setContentLength((int) csvFile.length());
ServletOutputStream out;
try {
out = resp.getOutputStream();
out.write(csvFile);
out.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
out.close();
out.flush();
}
}
Надеюсь, это поможет.
Обновление:
Вот как я нанес на карту byte[]
.
<property
name="image"
update="true"
insert="true"
not-null="false"
unique="false"
type="binary"
>
<column name="image" />
</property>