{"record":{"id":"ace208575684b05e","repo":"mybatis/mybatis-3","slug":"no-type-handler-found-for-javatype-and-j","errorCode":null,"errorMessage":"No type handler found for '\" + javaType + \"' and JDBC type '\" + rsw.getJdbcType(column) + \"'\"","messagePattern":"No type handler found for '\" \\+ javaType \\+ \"' and JDBC type '\" \\+ rsw\\.getJdbcType\\(column\\) \\+ \"'\"","errorType":"exception","errorClass":"ExecutorException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java","lineNumber":604,"sourceCode":"      return getNestedQueryMappingValue(rsw, metaResultObject, propertyMapping, lazyLoader, columnPrefix);\n    }\n    if (JdbcType.CURSOR.equals(propertyMapping.getJdbcType())) {\n      List<Object> results = getNestedCursorValue(rsw, propertyMapping, columnPrefix);\n      linkObjects(metaResultObject, propertyMapping, results.get(0), true);\n      return metaResultObject.getValue(propertyMapping.getProperty());\n    }\n    if (propertyMapping.getResultSet() != null) {\n      addPendingChildRelation(rs, metaResultObject, propertyMapping); // TODO is that OK?\n      return DEFERRED;\n    } else {\n      final String column = prependPrefix(propertyMapping.getColumn(), columnPrefix);\n      TypeHandler<?> typeHandler = propertyMapping.getTypeHandler();\n      if (typeHandler == null) {\n        final String property = propertyMapping.getProperty();\n        final Type javaType = property == null ? null : metaResultObject.getGenericSetterType(property).getKey();\n        typeHandler = rsw.getTypeHandler(javaType, column);\n        if (typeHandler == null) {\n          throw new ExecutorException(\n              \"No type handler found for '\" + javaType + \"' and JDBC type '\" + rsw.getJdbcType(column) + \"'\");\n        }\n      }\n      return typeHandler.getResult(rs, column);\n    }\n  }\n\n  private List<Object> getNestedCursorValue(ResultSetWrapper rsw, ResultMapping propertyMapping,\n      String parentColumnPrefix) throws SQLException {\n    final String column = prependPrefix(propertyMapping.getColumn(), parentColumnPrefix);\n    ResultMap nestedResultMap = resolveDiscriminatedResultMap(rsw,\n        configuration.getResultMap(propertyMapping.getNestedResultMapId()),\n        getColumnPrefix(parentColumnPrefix, propertyMapping));\n    ResultSetWrapper nestedRsw = new ResultSetWrapper(rsw.getResultSet().getObject(column, ResultSet.class),\n        configuration);\n    List<Object> results = new ArrayList<>();\n    handleResultSet(nestedRsw, nestedResultMap, results, null);\n    return results;","sourceCodeStart":586,"sourceCodeEnd":622,"githubUrl":"https://github.com/mybatis/mybatis-3/blob/008069adb1b089579b5dcba87ee591908b263274/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java#L586-L622","documentation":"While applying a resultMapping, MyBatis found no TypeHandler able to convert the column's JDBC value to the property's Java type. The mapping did not pin a typeHandler, so the registry lookup with the property's Java type plus the JDBC type of the column (reported in the message) returned null.","triggerScenarios":"getPropertyMappingValue with propertyMapping.getTypeHandler()==null and rsw.getTypeHandler(javaType, column) returning null — e.g. mapping an exotic javaType (some custom enum-ish type, java.time type in old versions) to an unusual JDBC type, or an enum property against a column with no string/numeric handler match.","commonSituations":"Mapping java.time.Instant/Year/ZoneId on older MyBatis versions; custom value classes without registering a TypeHandler; dialects returning odd JDBC type codes (e.g. Oracle TIMESTAMP_WITH_LOCAL_TZ) unknown to the registry; enums stored as custom DB types.","solutions":["Register a TypeHandler for the exact javaType/JdbcType pair: configuration.getTypeHandlerRegistry().register(MyType.class, JdbcType.X, new MyHandler())","Or specify the handler inline on the mapping: <result property=\"p\" column=\"c\" typeHandler=\"com.example.MyHandler\"/>","Change the property to a supported Java type (String, LocalDate on 3.4.5+) and convert in a setter","Upgrade MyBatis — newer versions ship handlers for more java.time and enum combinations"],"exampleFix":"<!-- before -->\n<result property=\"created\" column=\"created_at\" javaType=\"java.time.Instant\"/>\n<!-- after -->\n<result property=\"created\" column=\"created_at\" javaType=\"java.time.Instant\"\n        typeHandler=\"org.apache.ibatis.type.InstantTypeHandler\"/>","handlingStrategy":"validation","validationCode":"// Before running, confirm a handler exists for the pair\nTypeHandlerRegistry thr = sqlSessionFactory.getConfiguration().getTypeHandlerRegistry();\nTypeHandler<?> h = thr.getTypeHandler(Year.class, JdbcType.INTEGER);\nif (h == null || h instanceof UnknownTypeHandler) { thr.register(Year.class, JdbcType.INTEGER, new YearTypeHandler()); }","typeGuard":null,"tryCatchPattern":"try { session.selectList(\"sel.statements\"); } catch (ExecutorException e) { if (e.getMessage() != null && e.getMessage().contains(\"No type handler found\")) { register handler from the message's java/jdbc pair and retry once; } else throw e; }","preventionTips":["Register custom TypeHandlers in a mybatis-config <typeHandlers> block or a TypeHandlerRegistry bootstrap","Prefer mainstream java types (LocalDate, Instant on recent versions) for columns","Add an integration test per exotic column type"],"tags":["mybatis","typehandler","jdbc-type","mapping"],"backgroundTag":null,"analyzedSha":"008069adb1b089579b5dcba87ee591908b263274","analyzedAt":"2026-08-14T13:07:10.264Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}