Reputation: 435
i'm trying to read a timestamp column in mssql which is stored in timestamp but it was in hexadecimal type , i was trying to map it using spring jpa hibernate but it was throwing error below is my column type in hibernate
@Temporal(TemporalType.TIMESTAMP)
@Column( name ="last_upadtedon")
private Date updatedon;
it is throwing exception while trying to read from table, i have tried all the desired method but nothing seems to work for me how to read a timestamp column in hibernate. what did i miss here
Upvotes: 0
Views: 1145
Reputation: 175726
SQL Server timestamp is not the same as other timestamps. You should use DATETIME2
instead.
Is a data type that exposes automatically generated, unique binary numbers within a database. rowversion is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The rowversion data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime2 data type.
The timestamp syntax is deprecated. This feature is in maintenance mode and may be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
SQL Server Database Engine type | .NET Framework type
timestamp | Byte[]
Upvotes: 2