来自params的PreparedStatement setBigDecimal

时间:2017-04-05 07:48:12

标签: java jdbc prepared-statement bigdecimal

我有保存方法的DAO

public void save(BigDecimal cashBackAmount){
 try (Connection connection = dataSource.getConnection();
             PreparedStatement stmt = connection.prepareStatement(query)) {
             stmt.setBigDecimal(1, cashBackAmount);
             stmt.executeUpdate();
        } catch (SQLException e) {
            log.error(e.getMessage());
            throw e;
        }
    }
}

并且findbug说:

FindBugs: Unchecked/unconfirmed cast This cast is unchecked, and not all instances of the type casted from can be cast to the type it is being cast to. Check that your program logic ensures that this cast will not fa

我怎样才能设置BigBigDecimal?

stmt.setBigDecimal(1, new BigDecimal(????));

1 个答案:

答案 0 :(得分:2)

忽略警告/错误。在这种情况下,该消息完全没有意义。

很明显,您已收到require_once('nusoap/lib/nusoap.php'); $wsdl = 'wdls url'; $xml_array["RequestType"] = "AvailabilityRQ"; $xml_array["Login"] = array("UserName"=>"username","Password"=>"password","Version"=>"version"); $xml_array["CheckAvailabilityCriteria"] = array("CheckIn" => "07/05/2017","CheckOut"=> "07/11/2017","CountryID"=> "MAU","CityID" => "MAU","Currency" => "USD","Rooms"=>array("Room"=>array("Adult"=>"2","Child"=>"0"))); $xml_array1['XMLRequest'] =$xml_array; $client = new nusoap_client($wsdl, false); $client->soap_defencoding = 'UTF-8'; $err = $client->getError(); if ($err) { echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; exit(); } $result = $client->call('HotelSearch', $xml_array1,'','http://tempuri.org/IService1/HotelSearch',false,false,'',''); if ($client->fault) { echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2>'; } else { $err = $client->getError(); if ($err) { echo '<h2>Error</h2><pre>' . $err . '</pre>'; } else { $result_count = $array_result['TotalResult']; if($result_count) { $hotels_list = $array_result['AvailHotels']['Hotel']; for($i=0; $i<count($hotels_list);$i++) { $hotel_name = $hotels_list[$i]['@attributes']['Name']; $hotel_code = $hotels_list[$i]['@attributes']['Code']; echo "Hotel name is <i>$hotel_name</i> and hotel code is <i>$hotel_code</i>"; echo "</br></br>"; } } } } 。因此,您不可能收到其他一些对象。