私は現在SpringbootでMybatisを使用しています。私はmybatis-config.xml
を追加しなかった。私はこれができmybatis-spring-bootのEnumOrdinalTypeHandlerのマッピング方法は?
Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'gender' from result set.
Cause: java.lang.IllegalArgumentException: No enum constant com.mycom.myproducts.mywebsite.config.bean.config.UserBean.Gender.0
を問題はMyBatisのが私の列挙型のためにマップすることはできませんです
### Database Configuration
spring.datasource.url=jdbc:sqlserver://localhost;databaseName=mywebsite;catalogName=mywebsite
spring.datasource.username=sa
spring.datasource.password=root
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
### Mybatis Configurations ###
mybatis.type-aliases-package=com.mycom.myproducts.mywebsite.config.bean
mybatis.type-handlers-package=org.apache.ibatis.type.EnumOrdinalTypeHandler
mybatis.mapperLocations=classpath:mybatis/mapper/**/*.xml
mybatis.configuration.default-fetch-size=100
mybatis.configuration.default-statement-timeout=30
以下のよう mybatis-spring-boot-autoconfigureの指示からapplication.properties
を経由してデータソースとMyBatisのためのすべての設定を行うと、エラーショー
<typeHandlers>
<typeHandler handler="org.apache.ibatis.type.EnumOrdinalTypeHandler" javaType="com.mycom.myproducts.mywebsite.config.bean.config.UserBean$Gender"/>
</typeHandlers>
でmybatis-config.xml
によって固定されているが、私は、これはによって行うことができるかわかりませんファイル?
こんにちは!ありがとうございました...私はこれがうまくいくと思いますが、例外があります '原因:org.apache.ibatis.type.TypeException:org.apache.ibatis.type.UnknownTypeHandler'クラスで使用可能なコンストラクタを見つけることができません。 '原因:java.lang.NoSuchMethodException:org.apache.ibatis.type.UnknownTypeHandler。() '私は何をすべきか ?敬具。 –
Cataclysm
実用的なサンプルコードについて記述できますか?親切に.... – Cataclysm