我在Spring中使用@Audited
注释来审核我的数据库中的更新,创建等。
但是我在我的数据库上获得的日期时间比实时少2小时,例如,我创建了一个对象并且我保存了它,我有创建日期时间:2014-08-04 12: 0但是我在14:00创建了它。
这是我的Auditor课程,每个被审核的课程都会扩展:
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class AbstractAudit implements Auditable<String, Long>, Serializable {
@Version
private int version;
@JsonIgnore
@Column(updatable=false)
private String createdBy;
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
@DateTimeFormat(iso=ISO.DATE_TIME)
@JsonIgnore
@Column(updatable=false)
private DateTime createdDate;
@JsonIgnore
private String lastModifiedBy;
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
@DateTimeFormat(iso=ISO.DATE_TIME)
@JsonIgnore
private DateTime lastModifiedDate;
//getter and setter method
}
我该如何解决? 我是否在项目或服务器(Tomcat 7)上添加了一些配置?
由于
答案 0 :(得分:3)
尝试在jpa提供程序设置中设置此属性:
<prop key="jadira.usertype.databaseZone">jvm</prop>
希望这有帮助。
此致