]
Gail Badner commented on HHH-5219:
----------------------------------
I believe this is a duplicate. Please check to see if this is already an issue reported
for 3.5.x:
DATETIME column incorrectly validates against DATE column
---------------------------------------------------------
Key: HHH-5219
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5219
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.1
Reporter: Ian Haken
Attachments: validation-fix.patch
org.hibernate.mapping.Table.validateColumns incorrectly validates if the expected SqlType
is DATETIME and the actual SqlType is DATE. This can be reproduced as follows:
Create a MySQL table with DATE type for column foo.
Create an Entity with java.util.Date member foo, annotated with
@Temporal(TemporalType.TIMESTAMP).
Initiate a Hibernate session with hibernate.hbm2ddl.auto=validate.
An exception should be thrown and is not. Looking at the code in
src/main/java/org/hibernate/mapping/Table.java, it is clear why this would occur; the
check is:
col.getSqlType( dialect, mapping ).toLowerCase().startsWith(
columnInfo.getTypeName().toLowerCase() )
I'm not sure if there was a particular reason for using startsWith rather than
equals, but I've changed startsWith to equals in the suggested patch (attached).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: