Hi Thomas,
thank you for your much appreciated answer. I see you point regarding the use of java.util.Date.
You write that the times are equal before they are going into the database. However this is not the case:
Timestamp t1 = new java.sql.Timestamp(1162080120000l);
Timestamp t2 = new java.sql.Timestamp(1162083720000l);
System.out.println("Are timestamps equal?: " + t1.equals(t2));
System.out.println(t1.getTime());
System.out.println(t2.getTime());
Output:
Are timestamps equal?: false
1162080120000
1162083720000
So it still is strange, that this results in a unique constraint violation, even if the toString()-method returns the same formatted date.
I assumed, that the timestamp is persisted as a long, in this case there should be no unique constraint.
Is it converted to a string and persisted as this string? Or is it converted to a string and back to long?
On the client side we check the dates for equality and as they are not equal a unique constraint violation is unexpected.
As a result from your answer we could implement the equality different (using the formatted string instead of the timestamp), which probably will be the way to go, if there is no way to solve this in H2.
But maybe you still see a solution to handle this different in H2?
Regards,
Maarten
> To unsubscribe from this group, send email to h2-database+unsubscribe@googlegroups.com.