[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1811) Parameters of type Long should be casted as SIGNED in MySQL when using cast()

Andreas Bergander (JIRA) noreply at atlassian.com
Fri Apr 20 04:45:06 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26786 ] 

Andreas Bergander commented on HHH-1811:
----------------------------------------

The same thing applies to the types double and float. These should be replaced by decimal which is avaible as of MySQL 5.0.8. The following patch to MySQL5Dialect.java seems to work fine:

	@Override
	public String getCastTypeName(int code) {
		if ( code==Types.DOUBLE || code==Types.FLOAT ) {
			return "decimal";
		}
		else {
			return super.getCastTypeName( code );
		}
	}

> Parameters of type Long should be casted as SIGNED in MySQL when using cast()
> -----------------------------------------------------------------------------
>
>                 Key: HHH-1811
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1811
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-hql
>         Environment: MySQL4.1, Hibernate 3.1.3
>            Reporter: Ricardo Illgen
>            Priority: Minor
>
> When using the function cast() in mysql, hibernate doesnt handle properly the properties of type Long. I made a workaround in my application extending the MySQLDialect class, and overwriting the getCastTypeName(int code) method, so it returns "signed" for BIGINT sql types too. Currently its falling back to the ancestor class method and returning "long" which causes an syntax error in MySQL.

-- 
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