• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

iBATIS - Error while accessing a column with hyphen in the name

 
Karthic Raghupathi
Greenhorn
Posts: 9
Java jQuery Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys!

There is a column in the database with hyphen in the name: 'SMS-PAGER'.

I use iBATOR to generate the iBATIS artefacts which I then use in my program to make database hits.

When iBATIS executes a statement to select data from this table, I get an exception, the details of which are:

Failed to execute queryForObject - id [Doctors.ibatorgenerated_selectByPrimaryKey], parameterObject [queuer.dao.model.Doctors@25d2b2]. Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in queuer/dao/mapping/Doctors_SqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the Doctors.ibatorgenerated_selectByPrimaryKey-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'SMS'.

The hyphen in the name is causing that error.

I want to know if there is any configuration in iBatis that has to be changed to work around this.

I know it is bad to have a hyphen in the name, but that was how it was done and I do not want to go changing the name of the field because I need to change it in all the legacy applications that now depend on it unless I have no other way around this.

Any help would be greatly appreciated. Thanks for your patience and time.

Regards
Karthic
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic