I'm new to Hibernate and am working with an Oracle 10g database. We have columns in our tables that are of type TIMESTAMP WITH TIMEZONE
. Hibernate does not seem to support this mapping directly. Is there a standard way to go about this?
相关问题
- Can I skip certificate verification oracle utl_htt
- mySQL alter table on update, current timestamp
- Display time in local timezone when querying Influ
- How to account for clock offsets in a distributed
- how to calculate sum time with data type char in o
相关文章
- node连接远程oracle报错
- oracle 11g expdp导出作业调用失败,提示丢包。
- Hibernate Tutorial - Where to put Mapping File?
- 执行一复杂的SQL语句效率高,还是执行多少简单的语句效率高
- Hibernate doesn't generate cascade
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- Setup and Tear Down of Complex Database State With
- Difference between FOR UPDATE OF and FOR UPDATE
An example of a UserType storing java.util.Calendar with time zone information is given in this blog post: http://www.joobik.com/2010/12/mapping-dates-and-time-zones-with.html
TIMESTAMP WITH TIMEZONE
is Oracle extension and thus is not supported by Hibernate out of the box. You have two options:1) Change your table structure to store timezone in a separate column (as VARCHAR2). Hibernate is able to map java.util.TimeZone as
timezone
type using its ID.2) Write a custom class to hold both timestamp and timezone and a custom UserType that would persist it. It will have to be a CompositeUserType if you need the ability to use its individual properties (e.g. timezone or timestamp) in queries. Look at this example to get you started; you'll need to alter it to actually store the timezone.