ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Strange problems with Custom Type Handler
Date Thu, 20 Jan 2005 21:01:04 GMT
There's no logging.  The best way to debug this is to step through the
code with a good IDE.

Just for fun, why not try this:

<result column="frequency_id" property="frequency"
typeHandler="reporting.viewer.dao.ibatis.FrequencyTypeHandler"/>

Honestly, you're using CTH in a different way than I had
intended....but that's not a bad thing.  I actually like the way
you've configured it.  I'm just not sure if it will work.

CTH was intended to support primary Java types and JDBC types.  I
didn't intend to support complex classes...that said, it's kind of a
cool idea.

Cheers,
Clinton


On Thu, 20 Jan 2005 13:48:26 -0700, Nathan Maves <Nathan.Maves@sun.com> wrote:
> Team,  This issues is really stumping me.  Is there any logging in the
> ibatis classes themselves?
> 
> Nathan
> On Jan 20, 2005, at 10:33 AM, Nathan Maves wrote:
> 
> > forgot to add my typehandler info..
> >
> >
> > <typeAlias alias="Frequency" type="reporting.viewer.domain.Frequency"/>
> > <typeHandler javaType="Frequency"
> > callback="reporting.viewer.dao.ibatis.FrequencyTypeHandler"/>
> >
> > package reporting.viewer.dao.ibatis;
> >
> > import java.sql.*;
> > import com.ibatis.sqlmap.client.extensions.*;
> > import reporting.viewer.domain.Frequency;
> >
> > public class FrequencyTypeHandler implements TypeHandlerCallback {
> >
> >     public Object getResult(ResultGetter getter) throws SQLException {
> >         if (getter.wasNull())
> >             return null;
> >         return Frequency.get(getter.getInt());
> >     }
> >
> >     public void setParameter(ParameterSetter setter, Object parameter)
> > throws SQLException {
> >         if (parameter == null) {
> >             setter.setNull(Types.INTEGER);
> >         } else {
> >             Frequency frequency = (Frequency) parameter;
> >             setter.setInt(frequency.getValue());
> >         }
> >     }
> >
> >     public Object valueOf(String s){
> >         return s;
> >     }
> > }
> >
> > The really strange thing is that the result map is totally ignoring
> > this column.  Not even show a null value.
> >
> > On Jan 20, 2005, at 10:27 AM, Nathan Maves wrote:
> >
> >> everything in my development system works perfect but when I run it
> >> in my pro env the frequency_id column is ignored in the resultmap.
> >>
> >>
> >> here is the result map
> >>     <resultMap class="Report" id="ReportResult">
> >>         <result column="report_id" property="id" />
> >>         <result column="report_name" property="name" />
> >>         <result column="report_type" property="type" />
> >>         <result column="description" property="description" />
> >>         <result column="category" property="category" />
> >>         <result column="posted_date" property="postedDate" />
> >>         <result column="last_update_date" property="lastUpdateDate" />
> >>         <result column="frequency_id" property="frequency"/>
> >>         <result column="archive_ind" property="archive" />
> >>         <result column="parent_id" property="parentId" />
> >>         <result column="infopartner_ind" property="infoPartner" />
> >>         <result column="hierarchy_code" property="hierarchyCode" />
> >>         <result column="brio_job_id" property="brioJobId" />
> >>     </resultMap>
> >>
> >>     <resultMap class="Report" id="DetailReportResult"
> >> extends="ReportResult">
> >>         <result column="mime_type" property="mimeType" />
> >>         <result property="blob" column="report" jdbcType="BLOB"/>
> >>     </resultMap>
> >>
> >> here is the debug from my production system.
> >>
> >> DEBUG 01-20 10:21:48 {conn-100003} Connection
> >> (ConnectionLogProxy.java:42)
> >> DEBUG 01-20 10:21:48 {pstm-100004} PreparedStatement:          SELECT
> >>              A.report_id,             A.parent_id,
> >> A.report_name,             A.report_type,             A.description,
> >>            A.category,             A.posted_date,
> >> A.last_update_date,             A.frequency_id,
> >> A.hierarchy_code,             A.brio_job_id,
> >> A.archive_ind,             A.infopartner_ind,             A.report,
> >>           B.mime_type         FROM              RV_REPORT_HIERARCHY
> >> A, RV_REPORT_TYPE B         WHERE              A.report_id = ?
> >>      and A.report_type = B.id
> >> (PreparedStatementLogProxy.java:48)
> >> DEBUG 01-20 10:21:48 {pstm-100004} Parameters: [15434]
> >> (PreparedStatementLogProxy.java:49)
> >> DEBUG 01-20 10:21:48 {pstm-100004} Types: [java.lang.String]
> >> (PreparedStatementLogProxy.java:50)
> >> DEBUG 01-20 10:21:48 {rset-100005} ResultSet
> >> (ResultSetLogProxy.java:41)
> >> DEBUG 01-20 10:21:49 {rset-100005} Header: [report_id, report_name,
> >> report_type, description, category, posted_date, last_update_date,
> >> archive_ind, parent_id, infopartner_ind, hierarchy_code, brio_job_id,
> >> mime_type, report]  (ResultSetLogProxy.java:61)
> >> DEBUG 01-20 10:21:49 {rset-100005} Result: [15434, Agent Data Inbound
> >> by Hour Statistics, 2, Agent Data Inbound by Hour Statistics, null,
> >> 2005-01-19 02:17:31.0, null, true, 15253, false, 62000569, 6024,
> >> application/pdf, oracle.sql.BLOB@2504e0]  (ResultSetLogProxy.java:65)
> >>
> >> when I run the sql from a CL I get this
> >>
> >>  REPORT_ID     PARENT_ID     REPORT_NAME
> >> REPORT_TYPE     DESCRIPTION                            CATEGORY
> >> POSTED_DATE            LAST_UPDATE_DATE     FREQUENCY_ID
> >> HIERARCHY_CODE     BRIO_JOB_ID     ARCHIVE_IND     INFOPARTNER_IND
> >>  REPORT
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>                                                MIME_TYPE
> >>  15434         15253         Agent Data Inbound by Hour Statistics  2
> >>               Agent Data Inbound by Hour Statistics  (null)
> >> 2005-01-19 02:17:31.0  (null)               1                62000569
> >>           6024            1               (null)
> >> %PDF-1.3
> >>
> >> which you can see that the FREQUENCY_ID is 1 which is valid.
> >>
> >> What would cause the resultmap to ignore this column?
> >>
> >> Nathan
> >>
> >
> 
>

Mime
View raw message