Error calling EntityToQuery


When we call EntityToQuery and pass it either an entity object or array of entities it fails with the following error:

Element at position [35] does not exist in list

No matter what entity we pass into this function the error is always exactly the same.


OS: Linux (ortussolutions/commandbox:lucee5-alpine docker image)
DB: MSSQL 2016


Luis Majano
September 9, 2019, 6:51 PM

You should post your ORM entities, and the full stacktrace please

Pothys - MitrahSoft
September 30, 2019, 11:26 AM

, Did you saw above comment? If Yes, Please share a stacktrace here. It'll more helpful to improve the status of the ticket.

Pothys - MitrahSoft
April 16, 2020, 3:04 PM

, Did you face this issue now also? If not means, shall I close this ticket?

Abram Adams
April 22, 2020, 9:20 PM

Still unresolved. I’ll post entity and stacktrace shortly

Abram Adams
April 23, 2020, 7:13 PM

I think we’ve uncovered the issue. Our entity extends ColdBox’s ActiveEntity.cfc (old version, like CB v3.5’sh), which extends VirtualEntityService.cfc which extends BaseORMService.cfc. In the. latter two files, there are non-orm properties that do not specifically set persistent="false". This looks to be changed in later versions of ColdBox (probably to work around this issue?), but we’re stuck on this old version of CB for now. We’re updating our CB to apply this workaround, but is something that should either be documented or fixed.

At the core of the EntityToQuery is which grabs the properties from of the entity object and iterates over to create the query object. The underlying method to grab the properties checks theProperty.isPeristent() (which is misspelled in the code, btw ) ;, which if the “persistent” attribute is missing will default to true. This may be nothing, but perhaps this causes to return null indices in the array, causing to fail with the Element at position [35] does not exist in listerror?


Mircea Botez


Abram Adams




Fix versions