I'm trying to take advantage of the new discriminator and submap tags and I've come across something that seems rather odd to me. Basically, the inheritence situation we have is that an AffiliateAccreditation class is a subclass of the Accreditation class. So the resultmaps look something like this:
<resultMap id="accreditationResult" class="accreditation"> <result property="accreditationId" column="accreditation_id"/> <result property="contactID" column="contact_id"/> <result property="accreditationType" column="accreditation_type_id" typeHandler="accreditationTypeTHC"/> ...some more result tags... <discriminator column="accreditation_type_id" javaType="int"> <subMap value="1" resultMap="affiliateAccreditationResult"/> </discriminator> </resultMap> <resultMap id="affiliateAccreditationResult" class="affiliateAccreditation" extends="accreditationResult"> ...some result tags... </resultMap> Now when I start the application, there are no errors displayed relating to the SQLMaps stuff. However, as soon as I get the part of the application that uses a SQLMaps query, I get an exception: [26/05/05 09:49:37:991 EST] 2f7cb737 WebGroup X Servlet Error: Bad SQL grammar [] in task 'SqlMapClient operation'; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in au/com/asx/cis/dao/ibatis/maps/Staff.xml. --- The error occurred while applying a parameter map. --- Check the Staff.getStaffByLogon-InlineParameterMap. --- Check the results (failed to retrieve results). --- Cause: java.sql.SQLException: Invalid column name: org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'SqlMapClient operation'; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in au/com/asx/cis/dao/ibatis/maps/Staff.xml. --- The error occurred while applying a parameter map. --- Check the Staff.getStaffByLogon-InlineParameterMap. --- Check the results (failed to retrieve results). --- Cause: java.sql.SQLException: Invalid column name com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in au/com/asx/cis/dao/ibatis/maps/Staff.xml. --- The error occurred while applying a parameter map. --- Check the Staff.getStaffByLogon-InlineParameterMap. --- Check the results (failed to retrieve results). --- Cause: java.sql.SQLException: Invalid column name (exception goes on for quite a while, but you get the idea.) As you can see, I'm using iBatis in conjunction with Spring. The "getStaffByLogon" query just happens to be the first use of SQLMaps in the application. It resides in a totally different map (Staff.xml). The Staff object is not connected to the Accreditation objects in any way. If I comment out the discriminator and subMap lines, everything works as per normal. Somewhere in the stack trace, it points to the IntegerTypeHandler class, so I placed a breakpoint at IntegerTypeHandler:35 (within the getResult(ResultSet, String) method). Inspecting the parameters at that breakpoint, I found that it was looking for the integer value for the "accreditation_type_id" column, which is the same column specified in the discriminator tag. This is despite it not being anywhere close to that query. I've tried a few different combinations (specifying more than one subMap tag, trying a different javaType), but all end up the same. Any ideas? Geoff Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com