[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2740) SAPDBDialect generates wrong boolean expressions

Dirk Lachowski (JIRA) noreply at atlassian.com
Fri Oct 19 12:23:39 EDT 2007


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

Dirk Lachowski commented on HHH-2740:
-------------------------------------

Instead of using a derived class you can also bind the boolean value. Using the HibernateTemplate from spring, i can write

return getHibernateTemplate().find(
				"from Material where endOfLife = ?", true);

without getting an error.



> SAPDBDialect generates wrong boolean expressions
> ------------------------------------------------
>
>                 Key: HHH-2740
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2740
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>         Environment: SAP DB 7.6
>            Reporter: Matthias Wuttke
>   Original Estimate: 10 minutes
>  Remaining Estimate: 10 minutes
>
> The following code fragment works for MySQL, but does not for SAP-DB / MaxDB:
> bulkUpdate("UPDATE MyObject SET recent = false");
> The query Hibernate generates is:
> update my_object set recent=0
> The MaxDB error is "Constant must be compatible with column type and length". The following query works:
> update my_object set recent=false
> The same problem applies to SELECT queries generated by Hibernate for use with the SAPDB / MaxDB. 
> The following class fixes the problem (if you set it as the dialect to use):
> public class ExtSAPDBDialect extends SAPDBDialect {
> 	@Override
> 	public String toBooleanValueString(boolean bool) {
> 		return Boolean.toString(bool);
> 	}
> 	
> }
> To fix the bug, I think one should change SAPDBDialect.toBooleanValueString(boolean).
> hbm2ddl has some more bugs when using it with MaxDB. eg. using ";" as the statement separator, choosing the wrong column type for Strings longer than 4000 chars (but these bugs are not that bad). ;-)
> Best regards
> Matthias

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