1

I initially generated the entitis from the database. Now there were certain DB datatypes which weren't understoond by eclispelink, such as:

  • DateTime2
  • Date

They were just interpreted as strings.

Since I am using Java 8 I use LocalDate and LocalDateTime on the java side. And I created a converter from java.sql.Timestamp to these to Types. However this only works with the DB datatype DateTime, because only DateTime is recognized as timestamp by eclispelink.

I found this answer for hibernate.

How to expand the used dialect?

How can I add java datatype <-> db datatype mappings to my eclipselink configuration?

Ilyes
  • 14,640
  • 4
  • 29
  • 55
Mrvonwyl
  • 347
  • 2
  • 15
  • Eclipselink uses DatabasePlatform subclasses to define database specific field to java types. See https://www.eclipse.org/forums/index.php/t/313418/ and bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=458877 has a patch that what was described - you would do something similar for DateTime2 instead. – Chris Sep 06 '17 at 13:51

0 Answers0