tracker issue : CF-3960610

select a category, or use search below
(searches all categories and all time range)

ORMExecuteQuery not properly handling the "Unique" parameter

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

Reporter/Name(from Bugbase): Dale Twineham / Dale Twineham (Dale Twineham)

Created: 03/27/2015

Components: ORM Support

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Other

Vote Count: 0

Duplicate ID:	CF-3041790

Problem Description:Specifying "true" as the Unique parameter does not complain if the query results in multiple records returned

Steps to Reproduce:        
local.cities = ORMExecuteQuery("
              SELECT DISTINCT city
              FROM Offices
              WHERE status != 'I'
              AND officeType = 'Sales Office'
              ORDER BY city ASC",
              {cacheable=true, cachename='SalesOfficesCache'}

Actual Result: returns a list of records

Expected Result: should fail with a hibernate exception if more than one record matches the query

Any Workarounds:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3960610

External Customer Info:
External Company:  
External Customer Name: Dale
External Customer Email:  
External Test Config: ColdFusion 11,0,04,293328, SQL Server 2005, Ubuntu 12.04 64-bit



The above was actually a bug in our code that went undetected because the ORMExecuteQuery method was not failing as it should have. We should have set the unique parameter to false. We only found the bug when we upgraded a system to ColdFusion 10, update 15, where the above code started failing because it was returning multiple records. The specific error returned was "org.hibernate.NonUniqueResultException: query did not return a unique result: 142" However, in Coldfusion 11 there seems to have been a regression, because the example code should fail with unique set to true, but it is not failing.
Comment by External U.
7962 | March 27, 2015 12:13:59 PM GMT
Hi Dale, Can you please share the sample code without any dependency?
Comment by Nimit S.
7963 | July 06, 2015 11:05:42 PM GMT
Hi Dale, Please provide sample code without any dependency along with ColdFusion's settings summary.
Comment by Nimit S.
7964 | August 03, 2015 10:37:18 PM GMT
Hi Dale, This issue is fixed as part of ColdFusion 11 Update 5 and ColdFusion 10 Update 16.
Comment by Nimit S.
7965 | August 19, 2015 12:42:50 AM GMT