MyBatis日期类型 如何与SQLServer和java中的日期匹配的,

SQL Server 的SQL语句:

   ID                   int                  
   CreateTime           Timestamp        
   FileAdd              varchar(100)

MyBatis配置:

 <resultMap type="instrrmentmodel" id="instrrmentmodelMap">
        <id property="ID" column="ID"/>
       <result property="CreateTime" column="CreateTime"  javaType="java.sql.Timestamp" jdbcType="TIMESTAMP"/> 
        <result property="FileAdd" column="FileAdd"/>
    </resultMap>

TInstrrmentModel实体类部分代码:

     private  Integer    ID  ;                
    private   Timestamp  CreateTime ;             
    private String   FileAdd    ;

 public String  getCreateTime() {
        return  new SimpleDateFormat("yyyy:MM:DD").format(CreateTime);

    }
    public void setCreateTime(Timestamp createTime) {
        
        CreateTime = createTime;
    }

无条件查结果:

严重: Servlet.service() for servlet [MVC] in context with path [/EnterpriseEMS] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for sbzy.enterpriseems.model.domain.InstrrmentModel.selectList
### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
sbzy.enterpriseems.model.domain.InstrrmentModel.selectList] with root cause
java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for sbzy.enterpriseems.model.domain.InstrrmentModel.selectList

这个数据类型如何匹配呢!要命的很搞了半天

22不小了
浏览 6935回答 1
1回答

慕粉4165865

 javaType="java.sql.Timestamp"要用工具的时间戳,应该是 javaType="java.util.Timestamp"
打开App,查看更多内容
随时随地看视频慕课网APP