Can someone here help me with the following situation?
I have a MSSQL 2000 Database with Timestamp columns in tables.
So hibernate generated following code for Entity Bean with byte[] type for Timestamp columns:
Code:
private byte[] timestamp;
@Version
@Column(name = "Timestamp", nullable = false)
public byte[] getTimestamp() {
return this.timestamp;
}
public void setTimestamp(byte[] timestamp) {
this.timestamp = timestamp;
}
As I understood it, these columns get updated automatically, but when I try to create new objects I get following exception:
Quote:
org.hibernate.PropertyValueException: not-null property references a null or transient value: de.fhg.iml.otdassist.entitybeans.otdmodel.InObject.timestamp
So, in this situation I don't try to set the Timestamp property explicit, e.g.:
Code:
attr = new InAttribute();
attr.setInObject(obj);
attr.setSystemAttributeType(attrType);
attr.setBtId(btId);
attr.setCard(card);
attr.setSenderId("otdnetassist");
em.persist(attr);
So I tried to change the column type from byte[] to java.sql.Timestamp, but I get another exception that Date can not be implicitly converted.
How I can handle these Timestamp columns, there's very few information in Hibernate Documentation, maybe it is some MS SQL 2000 problem?
Thank you in advance,
Yuri