Hi all,
I have a bean with Date :
Code:
private Date storageTimestampOrNull;
With an XML mapping, this field is automatically set when inserting into database (it's OK, it's working) :
Code:
<timestamp name="storageTimestampOrNull" column="StorageTimestamp" source="db" />
I want to use Annotations. No problems for all other fields, including
@MappedSuperclass and
@Embeddable, but impossible to have this field
storageTimestampOrNull set when inserting. Here are my annotations for this field :
Code:
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "storage_timestamp", insertable = false, updatable = false)
@Type(type = "my.package.UtcTimestampUserType")
@Generated(GenerationTime.ALWAYS)
private Date storageTimestampOrNull;
UtcTimestampUserType is an UserType to force UTC storage.
I have done many searches, and many tests, such as :
Code:
@Column(columnDefinition = "timestamp default current_timestamp on update current_timestamp", ...)
or
Code:
@Column(nullable = false, ...)
but nothing to do,
storageTimestampOrNull is always null !
Note, for the moment, I'm working only with unit tests with HSQLDB, the target is PostgrSQL.
Versions used :
- org.hibernate:hibernate:3.2.7.ga
- org.hibernate:hibernate-annotations:3.2.1.ga
- hsqldb:hsqldb:1.8.0.10
but I can change ...
Any idea ?
Thanks
Xavier