net.sf.hibernate.type.StringType contains wrong SQL generation
--------------------------------------------------------------
Key: HHH-5516
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5516
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.5
Environment: (Actually Hibernate 3.5.4)
Reporter: Joachim Durchholz
Priority: Critical
objectToSQLString does not fulfill the contract on
org.hibernate.type.LiteralType.objectToSQLString for strings that contain single quotes.
I know that Oracle requires that quotes be doubled (and I believe that it follows the SQL standard in doing so), so
{{'\'' + (String) value + '\''}}
should be replaced with
{{'\'' + ((String) value).replace ("'", "''") + '\''}}
The issue was already considered in HB-192, but the discussion there was limited to security concerns and missed the contractual problem.
(I noticed the problem while searching for a way to do the reverse of objectToSQLString, namely parse an SQL constant expression into a LiteralType value. That's why I don't know how to construct a test case, sorry.)
--
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
_______________________________________________
hibernate-issues mailing list
hibernate-issues@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-issues