logo       


Bizzare discriminator/submap problem: msg#00431

Subject: Bizzare discriminator/submap problem
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
&#39;SqlMapClient operation&#39;&#59; 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 &#40;failed to retrieve
results&#41;.  
--- 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



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe