Problems with CF9 EntityLoad ()

I just started working with OR9 CF9 features and ran into a problem.

I have one table configured - a member in which there are 2 records.

If I try:

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

... I have to 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 two 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 return the result instantly.

Any ideas as to what the problem is / is?

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"; } 
+4
source share
1 answer

OK, I get it ...

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

Changing the name of the object and table to "sitemember" fixes the problem.

I would suggest that it works fine if there is a WHERE clause in the base HQL query following the "SELECT FROM" element; but if you just have a basic entityload ("member"), then it does not have this WHERE clause.

I wonder if there are other names that I need to avoid?

Thanks for the help, Henry!

+3
source

All Articles