When pulling dates from a view using JPA and EclipseLink I'm getting dates two days before the date in the SQL data. (ie 1965-01-01 becomes 1964-12-30 and 1998-12-31 becomes 1998-12-29)
I am mapping date fields in SQL Server 2008 R2 with the following annotations:
@Entity
@Table(name = "vw_Record")
@XmlRootElement
public class VwRecord implements Serializable {
@Column(name = "dateStart")
@Temporal(TemporalType.DATE)
private Date dateStart;
@Column(name = "dateEnd")
@Temporal(TemporalType.DATE)
private Date dateEnd;
The columns in SQL Server are defined as:
[dateStart] [date] NULL,
[dateEnd] [date] NULL
Any ideas why I am getting a consistent two day difference?
EclipseLink does not do any conversion, it is most likely occurring in JDBC.
You can trying executing a native SQL query through JPA and see what data it returns. Also try selecting the data through raw JDBC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With