tracker issue : CF-4198329

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

Null Ref Exception using Paramaterize Queries with HQL/ORM

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Darren Gavin / Darren Gavin ()

Created: 02/09/2017

Components: ORM Support

Versions: 2016

Failure Type: Non Functioning

Found In Build/Fixed In Build: All 2016 builds /

Priority/Frequency: Normal /

Locale/System: English / Windows 10 64 bit

Vote Count: 0

Problem Description:
java.lang.NullPointerException
	at org.hibernate.internal.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:415)
	at org.hibernate.internal.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:385)
	at org.hibernate.internal.QueryImpl.list(QueryImpl.java:99)
	at coldfusion.orm.hibernate.HibernatePersistenceManager._executeHQL(HibernatePersistenceManager.java:828)
	at coldfusion.orm.hibernate.HibernatePersistenceManager.executeHQL(HibernatePersistenceManager.java:757)
	at coldfusion.orm.hibernate.HibernatePersistenceManager.executeQuery(HibernatePersistenceManager.java:617)
	at coldfusion.orm.ORMUtils._executeQuery(ORMUtils.java:348)
	at coldfusion.tagext.sql.QueryTag.startQueryExecution(QueryTag.java:797)
	at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:768)
	at cftest2ecfm1686140605.runPage(C:\Dev\ColdFusion Builder 3 workspace\amh\test.cfm:360)

Steps to Reproduce:
Was able to reproduce using three different methods of HQL query.

Method 1:
<cfscript>
		local.sqlText = "
				SELECT count(*) as countEDIsubmissions
				FROM FACILITY_DATA_SUBMISSION
				WHERE FDS_FACILITY_ID = ?
				  and FDS_SUBMISSION_METHOD = 'EDI'";
		local.facilityEDIStatus = ORMExecuteQuery(local.sqlText, [139]);

Method 2:
		local.sqlText = "
				SELECT count(*) as countEDIsubmissions
				FROM FACILITY_DATA_SUBMISSION
				WHERE FDS_FACILITY_ID = :facid
				  and FDS_SUBMISSION_METHOD = 'EDI'";
		local.facilityEDIStatus = ORMExecuteQuery(local.sqlText, {facid = 139);

Method 3:

		<cfquery name="LOCAL.facilityEDIStatus" dbtype="hql">
    				SELECT count(*) as countEDIsubmissions
				FROM FACILITY_DATA_SUBMISSION
				WHERE FDS_FACILITY_ID = <cfqueryparam  value="139">
				  and FDS_SUBMISSION_METHOD = 'EDI'
                </cfquery>

Actual Result:
same error above for all three versions

Expected Result:
For the HQL query to run.

Any Workarounds:
Found none, but attempted following:
Updated ColdFusion to 2016.3 - No Effect
Updated Java on host to 8.20 - No Effect
Updated the jre in ColdFusion to 8.20 - No Effect
Update the hibernate.core JAR file in \cfusion\lib to 5.2.6 - Cold Fusion unable to bind to the newer JAR.  - Restored 4.3.10 JAR file

Attachments:

Comments:

I found the underlying issue, the CFC ORM Generator in ColdFusion Builder 3 is sometimes not generating fields into the classes for ORM.
Comment by Darren G.
1197 | February 09, 2017 08:11:35 PM GMT
Darren, Are you still facing this issue? If yes, please let us know if it happens only if ColdFusion Builder is involved so that we can investigate it further. Thanks, Nimit
Comment by Nimit S.
1198 | May 08, 2017 05:19:58 AM GMT
Darren, Please let us know if you are still facing this issue so that we can investigate it further.
Comment by Nimit S.
1199 | July 07, 2017 12:37:31 PM GMT
The issue was related to ColdFusion Builder, and that the database had not properly set up foreign key constraints, so the cfc generator for ORM didn't know what to do with those fields, and left them out of the classes. Manually added those fields in fixes the issue. I don't think this needs to be addressed as a CF Builder issue either, as the true problem was a incorrect database design.
Comment by Darren G.
1200 | July 13, 2017 04:35:51 PM GMT
Thanks for the confirmation Darren. I am closing this bug.
Comment by Nimit S.
1201 | July 13, 2017 05:54:27 PM GMT