• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting data type mismatch error while adding a client form

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have one application where we are filling a form and subsequently thsese data are stored in database on click of "add " button. But, While clicking the button "add", i am getting the below mentioned error.



**"Failed to convert property value of type java.lang.String to required type boolean for property excelAttachFlag; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [] "**

Code :-

We have one property, named "excelAttachFlag" in our pojo class. The code in this class are :

private boolean excelAttachFlag;

public boolean isExcelAttachFlag() {
return excelAttachFlag;
}

public void setExcelAttachFlag(boolean excelAttachFlag) {
this.excelAttachFlag = excelAttachFlag;
}





Field used in database as :

EXCEL_ENABLED VARCHAR2(2 BYTE)


snippets of the code in "DAOJDBC" class is :

public boolean addClient(final AdminForm client) {

final Object params[] = new Object[] {client.getClientShortCode(),
client.getName(),
StringUtils.isBlank(client.getEmail()) ? null : client.getEmail(),
client.isExcelAttachFlag() ? "Y" : "N",

final StringBuilder sql = new StringBuilder(164);
sql.append("INSERT INTO CVR_CLIENT ");
sql.append("(INTERVENIENT_PSP,NAME, EMAIL, EXCEL_ENABLED)");
sql.append("VALUES (?, ?, ?, ?)");


protected static class ClientRowMapper implements RowMapper<Client> {
public Client mapRow(final ResultSet resultSet, final int rowCount) throws SQLException {
final Client client = new Client();
client.setRowCount(Integer.valueOf(resultSet.getInt("row_count")));
client.setShortCode(resultSet.getString("INTERVENIENT_PSP"));
client.setName(resultSet.getString("NAME"));
client.setEmail(resultSet.getString("EMAIL"));
String excelStatus=resultSet.getString("EXCEL_ENABLED");
if("Y".equalsIgnoreCase(excelStatus)){
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("------------excel enabled " + excelStatus);
}
client.setExcelAttachFlag(true);
}else{
client.setExcelAttachFlag(false);
}
return client;
}
}


View file ( VM file snippets) :-


<tr class="GMsearchFormA">
<td class="GMsearchstCol" nowrap="nowrap">#springMessage("label.name"):</td>
<td class="GMsearchstCol" nowrap="nowrap" colspan="2">#springFormInput("adminForm.name" "class='GMtradeSearch' size='80'")</td>
</tr>

<tr class="GMsearchFormA">
<td class="GMsearchstCol" nowrap="nowrap">#springMessage("label.attachExcel"):</td>
<td class="GMsearchstCol" nowrap="nowrap">#springFormCheckbox("adminForm.excelAttachFlag" "class='GMtradeSearch' size='80'")</td>

</tr>

could you please help me resolve this exception ?
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's the stack trace for that exception?
Where exactly is it thrown?

Also, when posting code please wrap it in code tags. There's a button for that in the post editor.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic