ドキュメントをMySQLデータベースに保存します。multipartFileからBlobへの変換に失敗しました
私はコントローラ
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String save(
@ModelAttribute("document") @Valid Document document,
BindingResult bindingResult,
@RequestParam("content") MultipartFile file) {
、フォーム、次のいる:
<form th:action="@{/save}" th:object="${document}" method="post" enctype="multipart/form-data">
<h4>Nazwa</h4>
<input type="text" th:field="*{name}"/>
<td style="color:red" th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></td>
<h4>Opis</h4>
<input type="text" th:field="*{description}"/>
<td style="color:red" th:if="${#fields.hasErrors('description')}" th:errors="*{description}"></td>
<h4>zawartosc</h4>
<input type="file" th:field="*{content}"/>
<td style="color:red" th:if="${#fields.hasErrors('content')}" th:errors="*{content}"></td>
を、私はこのエラーを修正する方法のアイデアを持っていない:
Failed to convert property value of type org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile to required type java.sql.Blob for property content; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile] to required type [java.sql.Blob] for property content: no matching editors or conversion strategy found