This line of code:
document.setContent((Blob) file);
Is throwing this error:
org.springframework.web.multipart.commons.CommonsMultipartFile cannot be cast to java.sql.Blob
Where file
is a MultipartFile
.
Eclipse does not throw any warning message from the "offending" line of code above. In fact, eclipse added the (Blob)
cast itself as part of a suggested fix.
Is there some other way that I can quickly and easily convert a MultipartFile
to a Blob
?
I have been working on this problem for a number of days now to no avail. See postings here and here. Simply being able to convert the MultipartFile
to a Blob
in a line or two of code would be an easy, elegant solution to an otherwise overcomplicated problem.