Java 8 LocalDate mapping with mybatis

前端 未结 4 1887
终归单人心
终归单人心 2020-12-28 17:10

I am using java.time.LocalDate (Java 8) to represent some of the member fields in a Java class.

class Test{
    private LocalDate startDate;
    private Local         


        
4条回答
  •  鱼传尺愫
    2020-12-28 17:39

    Look here: https://github.com/mybatis/typehandlers-jsr310

    If you are using mybatis version 3.4 or later, you can simply add this artifact on your classpath and MyBatis will automatically register the provided type handlers.

    
      org.mybatis
      mybatis-typehandlers-jsr310
      1.0.0
    
    

    If you are using an older version you need to register the type handlers manually.

    
      
      
      
      
      
      
      
    
    

    UPD:

    Type handlers for "JSR 310: Date and Time API" has been merged into mybatis core since 3.4.5.(See #974)

提交回复
热议问题