tags:

views:

83

answers:

1

I've only just started out with CF9's ORM features, and have run into a problem.

I've got a single table set up - member - which has 2 records in it.

If I try:

<cfscript>
members = EntityLoad("member");
writedump(members);
</cfscript>

...I should get an array of member objects; but I get the error:

unexpected token: member near line 1, column 6 [from member]

The error occurred in \\vmware-host\Shared
Folders\Web\sites\testbed\webroot\orm\index.cfm: line 2
1 : <cfscript>
2 : members = EntityLoad("member");
3 : writedump(members);
4 : </cfscript>

If I try:

<cfscript>
members = EntityLoad("member", {});
writedump(members);
</cfscript>

...I get the expected array of 2 member objects - but it takes 5-10 seconds to return it.

But if I request a unique object:

<cfscript>
members = EntityLoad("member", 1, true);
writedump(members);
</cfscript>

...I get the result returned instantaneously.

Any ideas as to what the problem(s) is/are?

member.cfc:

component output="false" persistent="true"
{
// identifier
property name="memberid" fieldtype="id"; 

// properties
property name="firstname";
property name="lastname";
property name="address1";
property name="address2";
property name="city";
property name="postcode";
property name="country";
property name="email";
property name="telephone";
property name="uuid";
property name="password";
}
+2  A: 

OK, I've figured it out...

It turns out that "member" is a (semi-)reserved word in Hibernate: https://forum.hibernate.org/viewtopic.php?f=1&amp;t=1005886&amp;start=0

Changing the object and table names to "sitemember" fixed the problem.

I would guess that it works fine if in the underlying HQL query there's a WHERE clause following the "SELECT FROM member"; but if you just have the basic entityload("member") then it doesn't have this WHERE clause.

I wonder if there are any other names I need to steer clear of?

Thanks for the help, Henry!

sebduggan