mybatis. java.lang.UnsupportedOperationException -
- why error code? don't understand.. *
help me plz.
tested it. dosave(), getlistcount(), dodelete(), getdetails() good.
but, getlist() method error occur!
i don't know why? what? method no parameter, 1 query
"select * tb_board_data"
my config : mybatis 3.2.2 / mybatis-spring 1.2.0 / spring 3.2.2
plz me.
package kr.co.goodwilldd.board.mapper; import java.util.arraylist; import org.apache.ibatis.annotations.delete; import org.apache.ibatis.annotations.insert; import org.apache.ibatis.annotations.select; import org.apache.ibatis.annotations.selectkey; import org.apache.ibatis.mapping.statementtype; import org.springframework.stereotype.repository; @repository public interface commonboardmapper<t> { @select(value = "select count(*) tb_board_data") public long getlistcount(); @select(value = "select * tb_board_data") public arraylist<t> getlist(); @select(value = "select * tb_board_data bseq = #{_seq}") public t getdetails(long _seq); @selectkey(before=true, keyproperty="bseq", statementtype=statementtype.prepared, statement="select (ifnull(max(bseq),0)+1) bseq tb_board_data", resulttype=long.class) @insert(value = "insert tb_board_data(bseq, boardname, register, subject, content, restep, relevel, regdate) select #{bseq}, #{boardname}, #{register}, #{subject}, #{content}, ifnull(((floor(max(restep)/100))+1)*100+99, 199) , 0, current_date() tb_board_data") public int dosave(t t); @delete(value = "delete tb_board_data bseq = #{_seq}") public int dodelete(long _seq); }
error logs here
org.mybatis.spring.mybatissystemexception: nested exception org.apache.ibatis.exceptions.persistenceexception: ### error querying database. cause: java.lang.unsupportedoperationexception ### error may exist in kr/co/goodwilldd/board/mapper/commonboardmapper.java (best guess) ### error may involve defaultparametermap ### error occurred while setting parameters ### sql: select * tb_board_data ### cause: java.lang.unsupportedoperationexception @ org.mybatis.spring.mybatisexceptiontranslator.translateexceptionifpossible(mybatisexceptiontranslator.java:73) @ org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke(sqlsessiontemplate.java:364) @ com.sun.proxy.$proxy13.selectlist(unknown source) @ org.mybatis.spring.sqlsessiontemplate.selectlist(sqlsessiontemplate.java:194) @ org.apache.ibatis.binding.mappermethod.executeformany(mappermethod.java:114) @ org.apache.ibatis.binding.mappermethod.execute(mappermethod.java:58) @ org.apache.ibatis.binding.mapperproxy.invoke(mapperproxy.java:43) @ com.sun.proxy.$proxy25.getlist(unknown source) @ kr.co.goodwilldd.board.commonboardtest.getlistbymapper(commonboardtest.java:31) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:44) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:41) @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:20) @ org.junit.internal.runners.statements.runbefores.evaluate(runbefores.java:28) @ org.springframework.test.context.junit4.statements.runbeforetestmethodcallbacks.evaluate(runbeforetestmethodcallbacks.java:74) @ org.springframework.test.context.junit4.statements.runaftertestmethodcallbacks.evaluate(runaftertestmethodcallbacks.java:83) @ org.springframework.test.context.junit4.statements.springrepeat.evaluate(springrepeat.java:72) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:231) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:88) @ org.junit.runners.parentrunner$3.run(parentrunner.java:193) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:52) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:191) @ org.junit.runners.parentrunner.access$000(parentrunner.java:42) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:184) @ org.springframework.test.context.junit4.statements.runbeforetestclasscallbacks.evaluate(runbeforetestclasscallbacks.java:61) @ org.springframework.test.context.junit4.statements.runaftertestclasscallbacks.evaluate(runaftertestclasscallbacks.java:71) @ org.junit.runners.parentrunner.run(parentrunner.java:236) @ org.springframework.test.context.junit4.springjunit4classrunner.run(springjunit4classrunner.java:174) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) caused by: org.apache.ibatis.exceptions.persistenceexception: ### error querying database. cause: java.lang.unsupportedoperationexception ### error may exist in kr/co/goodwilldd/board/mapper/commonboardmapper.java (best guess) ### error may involve defaultparametermap ### error occurred while setting parameters ### sql: select * tb_board_data ### cause: java.lang.unsupportedoperationexception @ org.apache.ibatis.exceptions.exceptionfactory.wrapexception(exceptionfactory.java:23) @ org.apache.ibatis.session.defaults.defaultsqlsession.selectlist(defaultsqlsession.java:107) @ org.apache.ibatis.session.defaults.defaultsqlsession.selectlist(defaultsqlsession.java:98) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke(sqlsessiontemplate.java:354) ... 36 more caused by: java.lang.unsupportedoperationexception @ org.apache.ibatis.reflection.wrapper.collectionwrapper.findproperty(collectionwrapper.java:42) @ org.apache.ibatis.reflection.metaobject.findproperty(metaobject.java:76) @ org.apache.ibatis.executor.resultset.fastresultsethandler.applyautomaticmappings(fastresultsethandler.java:342) @ org.apache.ibatis.executor.resultset.fastresultsethandler.getrowvalue(fastresultsethandler.java:267) @ org.apache.ibatis.executor.resultset.fastresultsethandler.handlerowvalues(fastresultsethandler.java:216) @ org.apache.ibatis.executor.resultset.fastresultsethandler.handleresultset(fastresultsethandler.java:188) @ org.apache.ibatis.executor.resultset.fastresultsethandler.handleresultsets(fastresultsethandler.java:154) @ org.apache.ibatis.executor.statement.preparedstatementhandler.query(preparedstatementhandler.java:57) @ org.apache.ibatis.executor.statement.routingstatementhandler.query(routingstatementhandler.java:70) @ org.apache.ibatis.executor.reuseexecutor.doquery(reuseexecutor.java:54) @ org.apache.ibatis.executor.baseexecutor.queryfromdatabase(baseexecutor.java:259) @ org.apache.ibatis.executor.baseexecutor.query(baseexecutor.java:132) @ org.apache.ibatis.executor.cachingexecutor.query(cachingexecutor.java:105) @ org.apache.ibatis.executor.cachingexecutor.query(cachingexecutor.java:81) @ org.apache.ibatis.session.defaults.defaultsqlsession.selectlist(defaultsqlsession.java:104) ... 42 more
you should specify concrete type return type, like
list<customer> getlist();
, no generic type
list<t> getlist();
or
list getlist();
cause if specify type, mybatis use beanwrapper convert each row type. if there no specific type, mybatis treat each row list , use collectionwrapper, findproperty not supported.
Comments
Post a Comment