ORMService criteria expression

Just following examples from http://wiki.coldbox.org/wiki/Extras:BaseORMService.cfm#list

Using CF9, this wont work? inline expressions on method calls are
invalid or somethin?

void function listfiles(event) output=false{
  var rc = event.getCollection();
  rc.id = 1; // Simplified

  var entities =
ORMService.list(entityName="post",criteria={postID=rc.id}); // Error
Messages: Element ID is undefined in RC.
};

Dang, I should obviously point out defining the criteria struct before
hand works
criteria={postID=1};

ORMService.list(entityName="post",criteria=criteria);

might this be a CF9 issue, runtime expressions in method arguments are
a no-no?

Yes it is a bug in ColdFusion 9.

Regards,
Andrew Scott
http://www.andyscott.id.au/

From: coldbox@googlegroups.com [mailto:coldbox@googlegroups.com] On
Behalf Of Don Q
Sent: Friday, 18 March 2011 2:25 PM
To: ColdBox Platform
Subject: [coldbox:8786] Re: ORMService criteria expression

Dang, I should obviously point out defining the criteria struct before

hand

That bug should be fixed in CF9.0.1. Have you updated yet?

Wierd I also encountered the same bug today when writing up a unit
test. I have upgraded to 9.01 version.

Yep, running 9.01

Hmm. Well, I thought it was fixed in 9.0.1. Apparently it isn’t - at least for some people (two so far on this thread). I need to test it again and see.

newSt = {}; structAppend(newSt,{foo='bar'}); writeDump(newSt);

^ Works as expected for me here. I am on 9,0,1,274733.

I ran into this problem last week. Worked fine on my dev machine (single instance on mac an windows) but popped up on a multiserver clustered box (windows). Luis and I banged our heads for a while before we tracked it down. I’m running 9.01 as well. Fixed by declaring the criteria before calling the ORM method. I believe this is a CF bug.

Nolan Dubeau

Load .,8,1

hmmm you're right, that works fine.. but in the first handler snippet
example, that will crash in coldbox

Yep it is a coldfuison bug where referencing outside structures or
variables outside of the implicit declaration it fails on widows
multiple instance.

{Id=someVar.id}

So you are saying this bug only affects Windows (and not *nix) machines, and only with a JRun multi-instance (and not “server”) installation? If yes, do you know if it still exists on Windows under another J2EE server or servlet container (e.g. Glassfish, JBoss, Tomcat, etc.)?

That I do not know.

We tested, mac standalone and multi
then windows standalone is ok, multi is the one that faile.d

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

No, I know for sure it fails on a standalone instance of windows. I have seen it fail.

Curt

Luis, you are saying that my example…

newSt = {}; structAppend(newSt,{foo='bar'} ); writeDump(newSt);

… failed for you in Windows multi-server installation?

If that is the case, then there is definitely more to it than that. I am running that configuration on multiple servers, and my example works exactly as expected.

If you have some other easily testable example that fails, please pass along so that I can test on my machines, too. :slight_smile:

No, yours is fine

newSt = {}; structAppend(newSt,{foo='bar'} ); writeDump(newSt);

The problem I get is on calling methods with arguments and the argument is an implicit structure that needs a variable in the scope of the function

function test(event){

var rc = event.getCollection();

ormservice.list(entity=“Test”, criteria={id=rc.id});

}

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

When I reported this bug to Adobe 2 years ago, this would not be server install specific. And it would not work in instances like this.

public any function getCategories(event, tempTest = []) {

or

getCategories(event, []);

or

public any function getCategories(event, tempTest = {}) {

getCategories(event, {test1=1,test2=2});

Some of this has been fixed, but there are certain conditions that are not fixed. Have come across them on 9.01 many times myself, and this is on both standalone and mutlserver, j2ee installs I have seen them on.

Regards,

Andrew Scott

http://www.andyscott.id.au/