Thursday March 4, 2010 11:01 AM
Word Count: 528
Working on a project today I came across a strange issue so I thought I would get everyones opinion on it. I am not really sure if its something I am doing wrong, a bug or maybe I am just missing something. In this application I have event handling turned on.
So for nothing special and up until this point everything has been working fine. Today I am adding some ajax via everyone's favorite framework (jQuery of course) and I came across something. This is my ajax call to my remote method.
And my remote method that does a join to pull all users who have a role id equal to the argument passed.
If you were to turn event handling off this works fine but with it on I am seeing the following error.
coldfusion.runtime.TemplateProxy$InvalidRemoteAccessException: The method 'preLoad' in component D:\websites\extranetsteriscom\cfc\com\*****\*****\events\EventHandler.cfc cannot be accessed remotely.
Now in my event handler I have preLoad defined (because you have to when you implement another component) but it's not doing anything. Am I to believe that If I use event handling in my application I can't use ORM for any remote functions? I can certainly get down and write some sql but thats no fun :) Anyways, just thought I would share this and get your thoughts.
Monday January 18, 2010 10:26 AM
Word Count: 308
There will come a time when you need to add a calculated value to your entity. In this example we will look at why you would want to do this and how you can easily accomplish it. I whipped up a very simple user manager example. First we have some orm settings in our application component. The main thing to get out of this is that we are going to be using event handling.
Our user entity is very basic and there is nothing special going on at this point.
Now what if we wanted to display the users age somewhere in our code? We could easily do something like this.
[More]
Wednesday January 6, 2010 9:28 PM
Word Count: 365
So in my last post I was able to get some pretty awesome feedback on some questions I had. I am not going to go over everything about the post so please check it out first and read through the comments. In the end I wanted to find out how I could abstract commons functionality of the persistence layer in my application. What I am starting with here is by no means the *right* answer or my final, just my first stab.
I am going to use the cfbookclub datasource that ships with ColdFusion 9 so you can follow along at home. First we need to setup our application. This is my basic directory structure for the application and below is my Application component.
[More]
Wednesday January 6, 2010 9:19 AM
Word Count: 432
I decided before Christmas break that I really want to learn a couple new languages. I decided on picking up Groovy/Grails & Python. Now obviously I am not going to pick this up in a week but over the next year I want to get good with both of these languages. This has nothing to do with ColdFusion, in fact my passion for CF is really driving this. It's important to understand how other languages tackle problems in case you find yourself stuck in a similar situation.
I have been doing a lot of work lately with Hibernate in ColdFusion 9. As I write more and more code I realized that I was writing the same functionality over and over for each of my domain objects. For the purpose of this article lets use an e-commerce application. When your working with anytime of application you must identify the domain specific objects in your system. In our e-commerce application we could have (but not limited to) the following objects.
- Product
- Category
- Order
- Invoice
- Customer
Now we have an idea of what is going to make up my system I am going to start building out my domain objects and views. To keep it very simple I started out without incorporating any type of framework. For each of my domain objects I found out that there was common functionality between them. Here is a list of (but not limited to) some of the methods I need to perform on each object.
- New - I will create a new instance of the domain object.
- Load - I will load an existing object from a database based on the primary key.
- List - I will give you back a query of all the rows for this domain object.
- ListBy - I am a dynamic search that allows you to search by fields.
- Find - I will find rows based on hql
- FindBy - I am a dynamic finder that allows you to find exact matches dynamically (findByFirstAndLast("Dan","Vega"))
- Save - I will persist an object to the database.
- Delete - I will delete a row(s) from the database.
[More]
Tuesday August 25, 2009 4:18 PM
Word Count: 124
I have really been diving deep into the new ColdFusion 9 hibernate integration and I love it. I was working with a many-to-many relationship last night and I was having some issues. To enable hibernate there is 1 setting that is required and a few for this example that we are going to use for this example.
[More]