StatementCreatorUtils avoids direct calls with SQL type argument in case of Types.OTHER

Issue: SPR-8571
This commit is contained in:
Juergen Hoeller
2014-08-19 20:52:54 +02:00
parent 8c76381d95
commit 759f430ba5
2 changed files with 14 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -262,4 +262,15 @@ public class StatementCreatorUtilsTests {
verify(preparedStatement).setTimestamp(1, new java.sql.Timestamp(cal.getTime().getTime()), cal);
}
@Test // SPR-8571
public void testSetParameterValueWithStringAndVendorSpecificType() throws SQLException {
StatementCreatorUtils.setParameterValue(preparedStatement, 1, Types.OTHER, null, "test");
verify(preparedStatement).setString(1, "test");
}
@Test // SPR-8571
public void testSetParameterValueWithNullAndVendorSpecificType() throws SQLException {
StatementCreatorUtils.setParameterValue(preparedStatement, 1, Types.OTHER, null, null);
verify(preparedStatement).setNull(1, Types.NULL);
}
}