Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'schedu

Hey everyone,

I'm getting an error when i call selectByPrimaryKey on my mapper.  My
primary key is a UUID and i used a typeHandler to deal with it.

Here is the error i'm getting:

### Error querying database.  Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter
for property named 'scheduleguid' in 'class java.util.UUID'
### The error may involve
com.project.mappers.ScheduleMapper.selectByPrimaryKey-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: There is
no getter for property named 'scheduleguid' in 'class java.util.UUID'

My generatorConfig that pertains looks like this:
...
<table tableName="Schedule" domainObjectName="Schedule">
   <columnOverride column="ScheduleGuid" javaType="java.util.UUID"
jdbcType="OTHER"
typeHandler="com.project.typehandlers.UUIDTypeHandler"/>
</table>
...

and the generated selectByPrimaryKey part of the xml looks like this:
...
<select id="selectByPrimaryKey" parameterType="java.util.UUID"
resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from Schedule
    where ScheduleGuid =
#{scheduleguid,jdbcType=OTHER,typeHandler=com.project.typehandlers.UUIDTypeHandler}
  </select>
...

Thus, when i call ScheduleMapper.selectByPrimaryKey(UUID id), it's
rolling over saying that it can't find the scheduleguid property in
UUID...which is true.  Am i doing something wrong?

Any help would be appreciated

 

 

 

解决办法:

 

Do me a favor - in your MyBatis MapperConfig.xml file, add this:

<typeHandlers>
  <typeHandler handler="com.project.typehandlers.UUIDTypeHandler"
javaType="java.util.UUID" />
</typeHandlers>

Let me know if this fixes the problem.  If it does, I'll know where to
work on MyBatis.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值