You have attempted to dereference a scalar variable...

165 views
Skip to first unread message

awaken

unread,
May 24, 2007, 3:23:43 AM5/24/07
to transfer-dev
Sean Corfield suggested that I ask Mark directly, perhaps a bug in
Transfer, perhaps my own mucking, I dunno.

CFMX 7.02, Transfer v0.6.3, MS SQL 2005

I have the following package....

<package name="user">
<object name="User" table="Users">
<id name="UserID" type="numeric" />
<property name="FirstName" type="string" />
</object>
</package>

and the following code...

<cfset user = transfer.new("user.User") />
<cfset user.setFirstName("Thomas") />
<cfset transfer.save(user)>

When I run this on my existing users table, it saves the record, and
then throws:
You have attempted to dereference a scalar variable of type class
java.lang.String as a structure with members.

But when I create an entirely new identical table, it works just fine.
It also works fine using cfquery with select SCOPE_IDENTITY() as id.

So why does the new users table work fine? I dunno. I have 3 foreign
key constraints on the original users table (password, permissions, &
groups), but I'm not really thinking that's the problem.

Sean seemed to think that perhaps Transfer wasn't able to get the
newly inserted ID...

Many thanks for a direction other than the one I'm going in...

- Thomas


Stack Trace:


coldfusion.runtime.ScopeCastException: You have attempted to
dereference a scalar variable of type class java.lang.String as a
structure with members. at coldfusion.runtime.Cast._Map(Cast.java:898)
at coldfusion.runtime.CfJspPage._resolve(CfJspPage.java:1011) at
coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:
1123) at
cfTransferInserter2ecfc1480519849$funcINSERTBASIC.runFunction(C:
\JRun4\servers\Genesis\cfusion.ear\cfusion.war\transfer\com\sql
\TransferInserter.cfc:400) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
290) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:254) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
56) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:1807) at
cfTransferInserter2ecfc1480519849$funcCREATE.runFunction(C:
\JRun4\servers\Genesis\cfusion.ear\cfusion.war\transfer\com\sql
\TransferInserter.cfc:64) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
290) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:254) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
56) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:194) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:146) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1634) at
cfSQLManager2ecfc439769275$funcCREATE.runFunction(C:\JRun4\servers
\Genesis\cfusion.ear\cfusion.war\transfer\com\sql\SQLManager.cfc:60)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
290) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:254) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
56) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:194) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:146) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1634) at
cfTransfer2ecfc2018181437$funcCREATE.runFunction(C:\JRun4\servers
\Genesis\cfusion.ear\cfusion.war\transfer\com\Transfer.cfc:203) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
290) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:254) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
56) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:1807) at
cfTransfer2ecfc2018181437$funcSAVE.runFunction(C:\JRun4\servers\Genesis
\cfusion.ear\cfusion.war\transfer\com\Transfer.cfc:183) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:344) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
290) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:254) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
56) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:207)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:169) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:194) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:146) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:1634) at
cfTester2dBlank2ecfm1737030985.runPage(C:\JRun4\servers\Genesis
\cfusion.ear\cfusion.war\Tester-Blank.cfm:23) at
coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152) at
coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349) at
coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at
coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:219)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at
coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27) at
coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69) at
coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:
52) at
coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:
28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at
coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:
115) at coldfusion.CfmServlet.service(CfmServlet.java:107) at
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:
78) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91) at
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:
259) at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:
541) at jrun.servlet.http.WebService.invokeRunnable(WebService.java:
172) at jrunx.scheduler.ThreadPool
$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at
jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

SQL...


qInsertTransfer (Datasource=testDB, Time=0ms, Records=1) in C:
\JRun4\servers\Genesis\cfusion.ear\cfusion.war\transfer\com\sql
\TransferInserter.cfc @ 00:15:24.024

INSERT
INTO
Users
(
FirstName
)
VALUES
(
?
);
select SCOPE_IDENTITY() as id

Query Parameter Value(s) -
Parameter #1(cf_sql_varchar) = Thomas

Mark Mandel

unread,
May 24, 2007, 3:46:46 AM5/24/07
to transf...@googlegroups.com
That is quite strange... it looks like somehow the select
USER_IDENTITY() didn't work, and I got back no ID.

I know SQL Server often doesn't like tables like User... maybe you hit
one of those.

I can't say I've ever seen that error before, no.

Not sure what to give you as advice.

Mark


--
E: mark....@gmail.com
W: www.compoundtheory.com

awaken

unread,
May 24, 2007, 12:25:45 PM5/24/07
to transfer-dev
The table name is users, which I don't think is a reserved word in
MSSQL.

After your input... I duplicated the table, turned off auto numbering
in the new table, moved all the data from the original table to the
new table, turned autonumbering back on, recreated the constraints,
deleted the original table, and renamed the new table to users... and
now all seems to be working fine.

strange...

Should have tried that before posting.

Thanks for taking the time.

- Thomas

Sean Corfield

unread,
May 24, 2007, 1:02:50 PM5/24/07
to transf...@googlegroups.com
On 5/24/07, awaken <awa...@gmail.com> wrote:
> strange...
>
> Should have tried that before posting.

Who would have thought to do that tho'?

Definitely sounds like a MS SQL bug :)

Glad it's working and sorry I couldn't be more helpful off-list last night!
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Reply all
Reply to author
Forward
0 new messages