rss
twitter
Find out what I'm doing, Follow Me :)

Blog

2

It seems like Coldfusion 9 Cumulative Hot Fix 1 broke all my Mach-ii apps! Spent a day trying to debug everything rolling back my changes,
updating Mach-II etc. just to find out it was the hot fix!

Was getting all kind of weird errors on dependency injection from coldspring. I use CF ORM as well.

I'm glad I did the update only on my local machine. 

Any one else seen it? All is well now that I removed the hot fix...

Update:

This has been verified by Adobe (Bug # 82621). Here is the response from one of Adobe Engineer:

"Engineering was able to reproduce the issue you have reported and found that this issue is same as another bug we fixed recently. Bug – 82504. This bug is also caused because of regression with CHF  1. We are planning to release this bug fix along with CHF 2"

Keywords: No Parent error, CHF 1

0

ColdFusion Builder is finally here! You can buy it from here.

I have to say, I'm surprised by pricing. In a good way. At $299, it sure is worth the money. But there is more... You also get a complimentary license for Flash Builder 4 (Standard) with it! Additionally Flash Builder 4 now include pretty much all the features. See here for a version comparison.

Find out a CFBuilder tour near you to explore what CFB can do for you. If you are in Boston area, don't miss this one.

0

I'm still trying to wrap my head around the relationships in ORM. Yesterday I wanted to delete all the child entities with the parent is delete. No problem, there is an attribute for that. cascade="all-delete-orphan". Well, it wasn't working for me.

It turned out, in my Mach-II app I was using event-bean (by mistake) to prepare the bean and then calling EntityDelete() on it. The entity was getting deleted but the child entities were not getting deleted. No error either. Once I realized my mistake (event-bean), and changed to call-method to load the entity and then call entityDelete() on it everything worked fine.

So, what is the bug? Here is the code equivalent (artist-art example) of my mumbo-jumbo above:

 

var artist = new Artist();
artist.setArtistID(1);
entityDelete(artist);

 

In the code above artist is a transient object and I believe it should _not_ delete the record from the database. It should either throw error or ignore the delete. As it stands, it will delete the artist but not the arts, even with cascade="all-delete-orphan".  It even behaves a little funcky with inverse="true" option on relationship. 

Here is the code that works properly:

 

var artist = entityLoad("Artist", 1, true);
entityDelete(artist);

 

Here is thread on ORM google groups with examples:

http://groups.google.com/group/cf-orm-dev/browse_thread/thread/1d924dcc28185ddd

 

 

0

Great article on TDD.

http://research.microsoft.com/en-us/news/features/nagappan-100609.aspx

2

I had an interesting observation about datatype conversion in CF9 when dealing with an error in ORM. I was getting an error that said can't use double for an integer field type (something like that). Now, I know that ColdFusion is datatype "independent". So, all simple variables are of datatype "String". Given that, when we do:

 

<cfset myVar = 1 />
<cfdump var="#getMetaData(myVar).toString()#" />

 

The result is "class java.lang.string". Now, if we perform a sum:

 

<cfset myVar = 1 + 1 />
<cfdump var="#getMetaData(myVar).toString()#" />

 

The result is "class java.lang.Double". I expected it to be integer. I was assuming that on the Java side they will get converted to integer. So, next I tried:

 

<cfset myVar = javaCast("int",1) + javaCast("int",1) />

 

And the result was still "class java.lang.Double". 

So, is sum of two integer result in a "Double"? I will let people who are more intelligent than me answer and explain that to me.

But, in the mean time it causes issue when dealing with ORM. I was doing something like this:

 

var hql = "SELECT IsNull(MAX(sortOrder),0) FROM " & arguments.entity.getEntityName() ;
var newSortOrder = ORMExecuteQuery(hql,true) + 1;
arguments.entity.setSortOrder(newSortOrder);

 

This was throwing an error because the datatype of sortOrder field is integer and the type of newSortOrder was "Double". The error can be fixed by using javaCast("int",newSortOrder), but I just changed my select to "IsNull(MAX(sortOrder),0)+1" and it returned me a integer.

Anyone care to explain me why sum of two integer results in a Double in ColdFusion?

More Results: