Bug 899515 (JBPAPP6-1221) - HHH-6655 TemplateRenderer and CriteriaQueryBuilder.TrimSpec behaves differently for DB2 causing querybuilder.trim test in JPA2 TCK to fail
Summary: HHH-6655 TemplateRenderer and CriteriaQueryBuilder.TrimSpec behaves different...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: JBPAPP6-1221
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: EAP 6.1.0
Assignee: Brett Meyer
QA Contact:
URL: http://jira.jboss.org/jira/browse/JBP...
Whiteboard:
Depends On:
Blocks: JBPAPP6-905
TreeView+ depends on / blocked
 
Reported: 2011-09-14 12:47 UTC by Madhumita Sadhukhan
Modified: 2015-09-01 04:00 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-11 16:21:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Client_trim_from_standalone_DB2.jtr (78.70 KB, application/octet-stream)
2011-09-14 12:53 UTC, Madhumita Sadhukhan
no flags Details
Client_trim_from_standalone_postgresql.jtr (73.59 KB, application/octet-stream)
2011-09-14 12:53 UTC, Madhumita Sadhukhan
no flags Details
Client.java (207.72 KB, text/plain)
2011-09-14 12:53 UTC, Madhumita Sadhukhan
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBPAPP6-1221 0 Major Closed HHH-6655 TemplateRenderer and CriteriaQueryBuilder.TrimSpec behaves differently for DB2 causing querybuilder.trim test i... 2013-02-20 02:27:27 UTC

Description Madhumita Sadhukhan 2011-09-14 12:47:56 UTC
project_key: JBPAPP6

https://hibernate.onjira.com/browse/HHH-6655

Failing test:com.sun.ts.tests.ejb30.persistence.criteriaapi.querybuilder.Client
testname=trim

For DB2 a warning message is generated by TempateRenderer which is not seen for other databases:
WARN: HHH00174:Function template anticipated 3 arguments, but 2 arguments encountered

Also the query created is different in case of DB2:
Hibernate: select replace(replace(ltrim(rtrim(replace(replace(customer0_.NAME,' ','${space}$'),?,' '))),' ',?),'${space}$',' ') as col_0_0_ from CUSTOMER_TABLE customer0_ where customer0_.NAME=? fetch first 2 rows only

and finally it fails because of above warning:

javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: DB2 SQL Error: SQLCODE=-313, SQLSTATE=07001
 
For other DBs same code generates following query and test passes:

Hibernate: select trim(BOTH ? from customer0_.NAME) as col_0_0_ from CUSTOMER_TABLE customer0_ where customer0_.NAME=? limit ?

Attaching log and testcode

Comment 1 Madhumita Sadhukhan 2011-09-14 12:53:48 UTC
Attachment: Added: Client_trim_from_standalone_DB2.jtr
Attachment: Added: Client_trim_from_standalone_postgresql.jtr
Attachment: Added: Client.java


Comment 2 Madhumita Sadhukhan 2011-09-14 12:55:21 UTC
Strong can you please take a look at this? assigning to you.

Comment 3 Strong Liu 2011-09-14 14:47:16 UTC
may relates to this one https://hibernate.onjira.com/browse/HHH-1949

Comment 5 Rajesh Rajasekaran 2012-05-01 17:05:30 UTC
Link: Added: This issue is a dependency of JBPAPP-8827


Comment 6 Strong Liu 2012-05-09 02:35:42 UTC
Affects: Added: Release Notes


Comment 7 Strong Liu 2012-05-10 04:03:15 UTC
Affects: Removed: Release Notes 


Comment 8 Rajesh Rajasekaran 2012-06-06 22:26:14 UTC
Link: Added: This issue is a dependency of JBPAPP-9292


Comment 9 Rajesh Rajasekaran 2012-06-06 22:26:28 UTC
Link: Removed: This issue is a dependency of JBPAPP-8827 


Comment 10 Brian Stansberry 2012-08-14 19:01:05 UTC
https://hibernate.onjira.com/browse/HHH-6280

Comment 11 Brett Meyer 2012-09-25 14:17:00 UTC
After re-running the test on DB2 9, HHH-6280 appears to be no longer relevant.  I updated HHH-6655 with the real issue.

Comment 12 Brett Meyer 2012-10-09 15:54:02 UTC
HHH-6655 is resolved.  Unless there's a critical reason to patch this in EAP 6.0.1, I'm holding off until the component upgrade in 6.1.0.

Comment 13 Brett Meyer 2012-10-11 16:21:23 UTC
Release Notes Docs Status: Added: Documented as Resolved Issue
Release Notes Text: Added: For DB2 databases, the "trim" function had problems using parameter values as arguments.  Forcing Hibernate to default to using literal values in TrimFunction corrected the issue.


Comment 14 Anne-Louise Tangring 2012-11-13 20:46:40 UTC
Release Notes Docs Status: Removed: Documented as Resolved Issue 
Release Notes Text: Removed: For DB2 databases, the "trim" function had problems using parameter values as arguments.  Forcing Hibernate to default to using literal values in TrimFunction corrected the issue. 
Docs QE Status: Removed: NEW 



Note You need to log in before you can comment on or make changes to this bug.