spring - jadira usertype timezone -


i'm using jadira usertype + joda time in project. i'm using hibernate + spring. bean pojo use spring annotations @createddate , org.springframework.data.jpa.domain.support.auditingentitylistener automatically set creation date on bean when saved. in europe/rome timezone unfortunally in db date stored utc, instead when display value on client (javafx) date show in correctly timezone.

how can store data in db in correct timezone?

thanks much.

you need set property "jadira.usertype.databasezone".

either set explicit timezone, or "jvm" use whatever default timezone of jvm is.

<bean id="entitymanagerfactory" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean" p:jpaproperties-ref="jpaprops" />  <util:properties id="jpaprops">   <prop key="hibernate.show_sql">true</prop>   <prop key="hibernate.format_sql">true</prop>   <prop key="jadira.usertype.autoregisterusertypes">true</prop>   <!-- defaults storing utc dates in db otherwise -->   <prop key="jadira.usertype.databasezone">jvm</prop>   <prop key="jadira.usertype.javazone">jvm</prop> </util:properties> 

Comments