how to convert BLOB type to MultipartFile?

109 Views Asked by At

in my project i stored an attachment to mysql db as BLOB, but i need to retrieve it as a multipartfile. here is my code samples and i need to complete this

try {
    Connection conn = this.getConnection();
    try(PreparedStatement stmt = conn.prepareStatement(sql)) {
        stmt.setInt(1,mail_id);
        try(ResultSet rs = stmt.executeQuery()) {
            while (rs.next()){

                mailModel.setEmailId(rs.getInt("email_id"));
                mailModel.setEmailAddress(rs.getString("email_address"));
                mailModel.setMsgTemplate(rs.getString("msg_template"));
                mailModel.setPriority(rs.getInt("priority"));
                String jsonData = rs.getString("parameters");
                List<MailModel.Parameter> parameters = parseJsonParameters(jsonData);
                mailModel.setParameters(parameters);

                Blob blob = rs.getBlob("attachment");
                
            }
            return mailModel;
        }
    }
} 

i need to complete that smtp

0

There are 0 best solutions below