Category Selected:

wirebox

Blog

Don't Forget persistent="false" When Autowiring Entities

Curt Gratz |  January 21, 2011

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!

Read More

ColdBox 3.0.0 M6 Released!

Luis Majano |  August 08, 2010

I am super excited to announce the ColdBox Platform 3.0.0 M6 release! Why? Because it holds one of my favorite subjects......Caching! With this release we complete yet another standalone framework cycle with the introduction to CacheBox. However, we won't delve too much on CacheBox in this post as it is deserving of its own, so the next post is the announcement of the release of CacheBox 1.0. However, the major part of this release is CacheBox, so lets introduce this bad boy:

Read More

Mocking Objects with ColdBox Annotations

Luis Majano |  June 12, 2009
One of the nice things about ColdBox's model integration features are the ability to inject objects by using annotations via the cfproperty tag.  This gives a cleaner API to objects that don't really need to expose setters just for dependency injection purposes.  Why? well, in MY opinion, objects should be shy and only expose what they need to expose to the outside world.  By leveraging annotations, I can cleanly define the dependencies of my object and what is even better, it can...
Read More