AxelF
AxelF

Reputation: 109

DateTimeOffset with JPA (hibernate)

I have a JPA using Hibernate connected to SQLserver. It works but i have an exception each time i use entity with DateTimeOffset fields.

I tried with a custom type and used it like this:

@Basic(optional = false)
@Column(name = "EffectiveDate")
@org.hibernate.annotations.Type(type="DateTimeOffsetType")
private Serializable effectiveDate;

DateTimeOffsetType is my custom type I made like here: datetimeoffset hibernate mapping

But still, it don't works. How can I be able to read DateTimeOffset with hibernate and JPA?

Upvotes: 1

Views: 2597

Answers (1)

AxelF
AxelF

Reputation: 109

I finally resolved it by changing all the Serializable type of the fields in generated entities by TimeStamp types.

Upvotes: 2

Related Questions