Hi,

this is only for people using Microsoft SQL-Server, no need to read this if 
you're using another database:

We just stumbled across a problem while migrating to SQL Server 2008 R2 64 bit, 
newest JDBC-driver.
It seems that the datetime datatype (used for timestamps) never was suitable 
for being part of a primary key due to
rounding issues.
http://msdn.microsoft.com/en-us/library/ms187819.aspx
However it is used (i.e. some relations and some of our own tables) and we 
actually never faced any problems with that - up to now.
With any older versions all worked fine. But under certain circumstances with 
the newest server/driver combination we can
now reproduce an error when calling createOrStore twice with the same PK values 
right after another. The second statement
results in a primary key violation. Similar problem when executing 
findByPrimaryKey(entityPkJustStored) - not found.
Reason seems to be that the value itself is stored at a slightly lower 
precision that the comparison (second call)
is processed.

We're still investigating and are currently discussing two options:

(1)    use datetime2 (higher precision)

(2)    remove any "rounding-prone" datatypes like datetime etc. from primary 
keys (replace with integer types)

Regards.
Karl


Karl Eilebrecht
Key-Work Consulting GmbH | Kriegsstr. 100 | 76133 Karlsruhe | Germany | 
www.key-work.de<http://www.key-work.de>
Fon: +49-721-78203-277 | E-Mail: 
[email protected]<mailto:[email protected]> | Fax: 
+49-721-78203-10

Key-Work Consulting GmbH, Karlsruhe, HRB 108695, HRG Mannheim
Gesch?ftsf?hrer: Andreas Stappert, Tobin Wotring

Reply via email to