0

entity 、プライベート blob イメージで blob データ型を使用します。// ゲッターとセッターが作成されます ....

このコーディングをコントローラークラスに入力します

 @RequestMapping(value="save" , method=RequestMethod.POST)
public String save( @Valid Inpatient inpatient, RedirectAttributes redirectAttributes,
        @RequestParam("file") MultipartFile file) throws IOException
{

    System.out.println("Name:" + inpatient.getImagename());

    System.out.println("Filename :" + file.getName());

    Blob blob =(Blob) file.getInputStream();
      inpatient.setImagename(file.getOriginalFilename());
      inpatient.setImagefile(blob);


        inpatientService.save(inpatient);

しかし、私はこの種のエラーに直面しました

「org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0」という名前の Bean の作成中にエラーが発生しました

Mysqlもブロブのみを宣言します.....

私が使用する場合

@Lob
Private Blob image; // get and set

私はこの種のエラーに直面しました

java.lang.UnsupportedOperationException: ブロブはキャッシュできません

4

0 に答える 0