dragonorant opened a new issue #15083:
URL: https://github.com/apache/shardingsphere/issues/15083


   ```xml
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
       <version>5.0.0</version>
   </dependency>
   
   <dependency>
       <groupId>com.baomidou</groupId>
       <artifactId>mybatis-plus-boot-starter</artifactId>
       <version>3.5.0</version>
   </dependency>
   ```
   
   ```yml
   # mybaits-plus配置
   mybatis-plus:
     mapper-locations: classpath:/mapper/*Mapper.xml
     global-config:
       db-config:
         id-type: auto
         table-underline: true
         logic-delete-value: 1
         logic-not-delete-value: 0
         db-column-underline: true
         refresh-mapper: true
     configuration:
       map-underscore-to-camel-case: true
       default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler
       log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
     type-enums-package: com.sanyicloud.**.enums
   
   ```
   
   ```java
   @Data
   class Device{
       @TableField(value = "device_type")
       private DeviceTypeEnum deviceType;
   }
   
   @Getter
   @AllArgsConstructor
    enum DeviceTypeEnum implements IEnum<Short>{
       IOS((short) 1, "ios"),
       ANDROID((short) 2,"android"),
       OTHER((short) 3, "other"),;
       @EnumValue
       private final Short code;
       @JsonValue
       private final String desc;
       @Override
       public Short getValue() {
           return this.code;
       }
   }
   ```
   The above configuration can successfully insert data, but the data cannot be 
queried。
   
   exception
   ```text
   org.springframework.dao.InvalidDataAccessApiUsageException: Error attempting 
to get column 'device_type' from result set.  Cause: 
java.sql.SQLFeatureNotSupportedException: getObject with type
   ; getObject with type; nested exception is 
java.sql.SQLFeatureNotSupportedException: getObject with type
   
   Caused by: java.sql.SQLFeatureNotSupportedException: getObject with type
        at 
org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.getObject(ShardingSphereResultSet.java:373)
        at 
org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.getObject(ShardingSphereResultSet.java:378)
        at 
com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler.getNullableResult(MybatisEnumTypeHandler.java:118)
        at 
com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler.getNullableResult(MybatisEnumTypeHandler.java:49)
   ```
   
   Underlying code
   ```java
   ShardingSphereResultSet.class
   
       @Override
       public <T> T getObject(final int columnIndex, final Class<T> type) 
throws SQLException {
   // type == Short.class
           if (LocalDateTime.class.equals(type) || LocalDate.class.equals(type) 
|| LocalTime.class.equals(type)) {
               return (T) 
ResultSetUtil.convertValue(mergeResultSet.getValue(columnIndex, 
Timestamp.class), type);
           }
           throw new SQLFeatureNotSupportedException("getObject with type");
       }
   ```
   code
   ```java
   @Test
   public void test(){
       List<Device> list = thirdService.list();
   }
   
   ```
   
   How can I continue to use enumeration class object parameters


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to