Blog

Curt Gratz

January 21, 2011

Spread the word


Share your thoughts

I ran into a strange error yesterday that I couldn't seem to find out what was happening.

I was getting coldfusion.runtime.TemplateProxy cannot be cast to java.lang.String when trying to save an entity using ColdFusion ORM.  

Google was turning up nothing, so I started systematically removing lines of code.  It started working when I removed the line that did an entityLoad on a different object.  What was weird was I was just using that object to get a bit of data and not even for the object I was saving that caused everything to go boom, and if I removed the save, everything worked fine.  Then I remembered that the Hibernate session is affected so I took a deeper look at the entity that a loaded.  Sure enough, I was autowiring a property and didn't have persistent="false" on that property, causing it to throw the "coldfusion.runtime.TemplateProxy cannot be cast to java.lang.String" error.

Changing it from something like this

property name="shippingOriginationZip" inject="coldbox:setting:shippingOriginationZip";

to this

property name="shippingOriginationZip" inject="coldbox:setting:shippingOriginationZip" persistent="false";

fixed it all up.  Of course, like all coding solutions happen, this was in the middle of the night when I was no longer working on the code that this came to me.

So remember folks, if you have a property in an persistent CFC that is not persistent, be sure to say so!

Add Your Comment

Recent Entries

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Unfortunately, we often hear this message from clients who thought it would never happen to them... until it did. Some believed they could delay the expense of Implementing ColdFusion security best practices for one year, while others were tempted to put it off for just a few months. However, in today's rapidly evolving digital landscape, the security of web applications, including ColdFusio...

Cristobal Escobar
Cristobal Escobar
April 16, 2024
Ortus March Newsletter

Ortus March Newsletter

Welcome to Ortus Solutions’ monthly roundup, where we're thrilled to showcase cutting-edge advancements, product updates, and exciting events! Join us as we delve into the latest innovations shaping the future of technology.

Maria Jose Herrera
Maria Jose Herrera
April 01, 2024
Into the Box 2024 Last Early Bird Days!

Into the Box 2024 Last Early Bird Days!

Time is ticking, with less than 60 days remaining until the excitement of Into the Box 2024 unfolds! Don't let this golden opportunity slip away; our exclusive Early Bird Pricing is here for a limited time only, available until March 31st. Why wait? Secure your seat now and take advantage of this steal!

Maria Jose Herrera
Maria Jose Herrera
March 20, 2024