Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Fix saving null
Browse files Browse the repository at this point in the history
  • Loading branch information
alta189 committed May 13, 2012
1 parent e3ebddf commit adf1ca3
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -23,6 +23,10 @@
public class PreparedStatementUtils { public class PreparedStatementUtils {


public static void setObject(PreparedStatement statement, int index, Object o) throws SQLException { public static void setObject(PreparedStatement statement, int index, Object o) throws SQLException {
if (o == null) {
statement.setObject(index, null);
return;
}
Class clazz = o.getClass(); Class clazz = o.getClass();
if (clazz.equals(int.class) || clazz.equals(Integer.class)) { if (clazz.equals(int.class) || clazz.equals(Integer.class)) {
statement.setInt(index, ((Number) o).intValue()); statement.setInt(index, ((Number) o).intValue());
Expand Down

0 comments on commit adf1ca3

Please sign in to comment.