You are testing the other way around. The 'problem' is that when you
specify a column in a resultmap that's not actually delivered by the
query, you get a driver-specific 'Column name xxx was not found in this
ResultSet', which is to be expected imho.

 

The TS could either fix the problem by issuing a select * or use a
separate resultmap, they can be extended to avoid duplication. The real
question should probably be, why specify properties in the resultmap
that aren't available in the resultset?

 

Niels

 

________________________________

From: Clinton Begin [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 9 oktober 2007 15:56
To: user-java@ibatis.apache.org
Subject: RE: Unknown Column Name problem

 

I'm REALLY surprised iBATIS isn't telling you which result mapping is
causing the problem.  It almost always reports this.  For example, I
just purposely changed one of my mappings to imitate an invalid column
problem:

 

If the property name is incorrect, it should fail upon initialization
with:

 

Caused by: com.ibatis.common.beans.ProbeException: There is no WRITEABLE
property named 'xdescription' in class 'org.xxxxxx.facebook.domain.Gift'

 

If the column name is incorrect, it should fail with this:

 

Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   

--- The error occurred in org/xxxxxxxx/facebook/data/sql/Gift.xml.  

--- The error occurred while applying a result map.  

--- Check the Gift.GiftResult.  

--- Check the result mapping for the 'description' property.  

--- Cause: java.sql.SQLException: Column 'xdescription' not found.

 

Cheers,

Clinton

 

From: Rinaldo Bonazzo [mailto:[EMAIL PROTECTED] 
Sent: October-09-07 2:34 AM
To: user-java@ibatis.apache.org
Subject: Re: Unknown Column Name problem

 

Claus Hausberger ha scritto: 

I currently do not have access to the sources because I am not in the
office, but what you write is exactly my problem.
do I always have to specify all column names in the query that are also
in
the ResultMap ?
  

Yes

currently there are seven columns mentionned in the ResultMap and when I
specify all seven or when I use "Select *" it works, but when I specify
only two or three it does not work.
 
best wishes
 
Claus
 
  

        Could you post your Select that causes error and ResultMap?
         
        If you omit column that's present in the ReusltMap I guess
you'll get
        invalid column name exception...
            

 
  

 

Reply via email to