Issue setting property - not valid type

5 views
Skip to first unread message

gonzoprosperity

unread,
Oct 25, 2009, 8:44:09 PM10/25/09
to transfer-dev
Using Transfer v1.1 and latest Railo (3.1.1.000).

I have the tBlog sample app running just fine, no customizations. So
Transfer is verifiably working on Railo.

In a custom app I have a pretty basic Transfer setup, but its throwing
this error:

invalid call of the function setrepeat_on (/Users/xxxx/Projects//
autogen/events.EventInfo$0151FC0570BD5B63658174E21D8B48FB.transfer),
first Argument (repeat_on) is of invalid type, can't cast String [] to
a value of type [numeric]

The Transfer method that is triggering this is:

setPropertyMemento

if I dump out the memento object at the top of this method I see my
property and its value is an empty string - its NULL in the DB.

That field is defined as:

<property name="repeat_on" type="numeric" column="repeat_on"
nullable="true" nullvalue="0" />

This error is triggered by just calling a basic get:

transfer.get("events.EventInfo", 23);

The gist of the error is that if a method has a required argument of
type numeric and you attempt to give it an empty string than
ColdFusion (or I should say Railo) freaks out.

Now, I would think that adding nullvalue="0" to the property
configuration is exactly what the doctor ordered - but that doesnt
appear to be the case.

Without digging into the code too much at what point does Transfer
examine the data from the DB and then apply the "should I add the
nullvalue in?" functionality. Shouldnt it be done before
setPropertyMemento is called?

Thanks in advance.

gonzoprosperity

unread,
Oct 25, 2009, 8:46:10 PM10/25/09
to transfer-dev
Environment is: OS X 10.6.1 and SQL Server 2005

gonzoprosperity

unread,
Oct 25, 2009, 10:22:33 PM10/25/09
to transfer-dev
After digging into the code I have a fix, of sorts. In
transfer.com.sql.SQLValue in the method getPropertyColumnValue at the
bottom it detects if the input query was null but not the actual
value, e.g. the property value in question. The existing code is:

if(arguments.query.wasNull()) {
return getNullable().getNullValue(arguments.object.getClassName(),
arguments.property.getName());
}

But if I change it to ALSO test the actual property value:

if(arguments.query.wasNull() OR getNullable().hasNullValue
(arguments.object.getClassName(), arguments.property.getName())) {
return getNullable().getNullValue(arguments.object.getClassName(),
arguments.property.getName());
}

Then it all works and I got dump the memento struct and my default
value as defined in the XML gets applied.

The only problem is that the "hasNullValue" method on Nullable.cfc is
defined as private so I had to open it up to public so I could access
it from SQLValue.

/Cody
Reply all
Reply to author
Forward
0 new messages