I'm using the org.jadira.usertype.dateandtime.joda.PersistentDateTime
class from UserType 3.0.0.RC1 to map a JodaTime DateTime
to Hibernate. The Javadocs for the class mention that there are 'databaseZone' and 'jvmZone' properties which I would like to set, but I cannot find anything in the UserType documentation that indicates how to do this. I found this thread which seems to imply that these are set by XML similar to the following:
<prop key="jadira.usertype.autoRegisterUserTypes">true</prop>
<prop key="jadira.usertype.databaseZone">jvm</prop>
I tried adding these to my hibernate configuration, but that just gave an error. Does anyone know where this configuration needs to go? Thanks.
Those settings can indeed be placed in the hibernate configuration, as like the following:
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/SOME_DATABASE</property>
<property name="connection.username">root</property>
<property name="connection.password">password</property>
...
<property name="jadira.usertype.databaseZone">UTC</property>
<property name="jadira.usertype.javaZone">UTC</property>
</session-factory>
Turns out I was actually referencing an old version of the UserType library by mistake, which didn't support those properties. D'oh!
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