I initially generated the entitis from the database. Now there were certain DB datatypes which weren't understoond by eclispelink, such as:
DateTime2Date
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?