configurando blob a nulo usando PreparedStatement
Estoy creando una aplicación web usando JSF2.0 donde en mysql, estoy almacenando imágenes usando el tipo de datos comoMEDIUMBLOB
.
Para insertar valores, estoy usando PreparedStatement como se muestra a continuación.
PreparedStatement psmnt = con.prepareStatement("INSERT INTO sketchesSG002003 (userid, imageTitle, imageData, drawingComments) VALUES (?,?,?,?)");
psmnt.setLong(1, personalInfoId);
psmnt.setString(2, sketchesSG002003Title);
try {
String fileName = FilenameUtils.getName(sketchesSG002003ImageUpload.getName());
File image = new File(fileName);
InputStream fis = sketchesSG002003ImageUpload.getInputStream();
psmnt.setBinaryStream(3, fis, (int) sketchesSG002003ImageUpload.getSize());
} catch (Exception e) {
psmnt.setBinaryStream(3, null);
}
psmnt.setString(4, sketchesSG002003Comments);
i = psmnt.executeUpdate();
Sin embargo estoy recibiendo error como
java.lang.AbstractMethodError: com.mysql.jdbc.PreparedStatement.setBinaryStream(ILjava/io/InputStream;)V
Una parte de Stacktrace es
javax.faces.el.EvaluationException: java.lang.AbstractMethodError: com.mysql.jdbc.PreparedStatement.setBinaryStream(ILjava/io/InputStream;)V
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
Creo que el error anterior es para la declaraciónpsmnt.setBinaryStream(3, null);
Mi pregunta es ¿cómo puedo configurar los datos binarios como Nulo o Nada?