[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5219) DATETIME column incorrectly validates against DATE column
Gail Badner (JIRA)
noreply at atlassian.com
Wed May 12 14:36:23 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37098#action_37098 ]
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:
http://opensource.atlassian.com/projects/hibernate/secure/IssueNavigator.jspa?mode=hide&requestId=11080
Thanks,
Gail
> 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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list