Just another blog about the Java programming language
Reading and Writing UTC Timestamps to DB with Hibernate
Reading and writing UTC timestamps to a database when the default timezone may change. E.g., this might happen in an application server if an application running in the same JRE changes the default timezone as follows:
The easiest solution to solve this problem I know is to create an own mapping type extending the standard Hibernate timestamp type org.hibernate.type.TimestampType:
Use it as follows with Java annotations (you could use the type class also
in a XML configuration file):
Of course, this mapping class only works with Hibernate and is not standard JPA.