Convert LocalDate.MAX to Date

We are using Spring Data JPA to access a Derby-DB. Temporal values are defined as java.time.LocalDate (java 8 time api). Spring Data now is shipped with a org.springframework.data.convert.Jsr310Converters.LocalDateToDateConverter to convert LocalDate to java.util.Date, since - far as I know - JPA specification does not support LocalDate so far.

We now have an issue when converting a LocalDate.MAX to Date, resulting in the following exception (stripped):

Caused by: java.lang.IllegalArgumentException: java.lang.ArithmeticException: long overflow at java.util.Date.from(Unknown Source) at org.springframework.data.convert.Jsr310Converters$LocalDateToDateConverter.convert(Jsr310Converters.java:116) at org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters$LocalDateConverter.convertToDatabaseColumn(Jsr310JpaConverters.java:52) at org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters$LocalDateConverter.convertToDatabaseColumn(Jsr310JpaConverters.java:47) at org.hibernate.type.descriptor.converter.AttributeConverterSqlTypeDescriptorAdapter$1.bind(AttributeConverterSqlTypeDescriptorAdapter.java:97) ... 79 more Caused by: java.lang.ArithmeticException: long overflow at java.lang.Math.multiplyExact(Unknown Source) at java.time.Instant.toEpochMilli(Unknown Source) ... 84 more

Anyone who also faced this issue and have a suggestion to overcome this issue?


java.util.Date doesn't support dates that far into the future. See its javadoc :

Instant can store points on the time-line further in the future and further in the past than Date.

Consequently you would have to define your own JPA AttributeConverter and maybe store it as a String, or some other type


  • Sending emails over SMTP with TSL
  • Using nodejs server with request package and function pipe()?
  • java drawing on JPanel with timer/delay
  • Inputting a number then reversing it
  • What is wrong with this emulation of CMPXCHG16B instruction?
  • XMPPConnection Error in android
  • OAuth2 flow for mobile app
  • Java PrintWriter output looks weird in notepad
  • How concerned should we be about thread safety with JSF managed beans?
  • Using Login with Paypal and using OpenID with AWS Cognito
  • C#, “Object reference not set to an instance of an object.” error
  • How to Compose OSGi Based project with C++ based project?
  • Why isn't \\\\ interpreted as a blackslash in this regex?
  • Cassandra NoClassDefFoundError: com/google/common/util/concurrent/AsyncFunction
  • How do I change the kernel/python version for iPython?
  • java.lang.IndexOutOfBoundsException occuring on ArrayList
  • How to Make a Spinner (In a Fragment) That Changes the App's Language?
  • drawing random circles, storing their coorindates in an array
  • Android Database Error - getWriteableDatabase
  • Using Generics on right hand side in Java 6?
  • WPF Visiblity Binding to Boolean Expression with multiple Variables
  • What is the purpose of TaskExecutor in spring?
  • Conversion from string “a” to type 'Boolean' is not valid
  • how to find common suffix in java by using method
  • Installing Apache MyFaces 2 on WildFly 8.2.0
  • Hardware Accelerated Image Scaling in windows using C++
  • Row Count Is Returning the incorrect number using RaptureXML
  • $wpdb not working in file of WordPress plugin
  • Display issues when we change from one jquery mobile page to another in firefox
  • Illegal mix of collations for operation for date/time comparison
  • Different response to non-authenticated users and AJAX calls
  • Can I make an Android app that runs a web view in Chrome 39?
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Release, debug version and Authorization Google?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Arrays break string types in Julia
  • Data Validation Drop Down Box Arrow Disappearing
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to include full .NET prerequisite for Wix Burn installer
  • Hits per day in Google Big Query