Skip to content

primitive array resultType throws exception #555

@hoomanv

Description

@hoomanv

This issue has been reported previously at #259 and fixed.
But I think it is still broken.
mybatis version= 3.3.0

I have
   int[] getValues(...
mapped to
   <select id="getValues" resultType="int">

I get this exception
Caused by: java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
   at org.apache.ibatis.binding.MapperMethod.convertToArray(MapperMethod.java:144)

At line 144 of MapperMethod.java you are trying to cast int[] to Object[] since E resolves to Object
E[] array = (E[]) Array.newInstance(method.getReturnType().getComponentType(), list.size());

Metadata

Metadata

Assignees

Labels

enhancementImprove a feature or add a new feature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions