Entries Tagged as Transfer
Of Views and Models and Working With Transfer ORM
Posted by Paul Marcotte | Tags: Learning , Modeling , Transfer
Yesterday, I asked Mark Mandel for some advice on tuning my object model for performance. Mark, being an ever-so-helpful (P)OSS author, gave me a few suggestions. Turns out that someone asked basically the same question on the transfer list today. Jaime Metcher made a couple of excellent points on choosing between queries and object composition. Paraphrasing, Jaime, when working with large data sets (the type of thing you might be tempted to use arrays of objects for), you will get better performance using a query. If you want to display a single instance of some object and the view is truly a composite, then your model should reflect that composition. Understanding this helps with choosing between onetomany or manytoone relationships for your object compositions.Working with Transfer ORM: TQL, MSSQL and Reserved Words
Posted by Paul Marcotte | Tags: MSSQL , Transfer
I'm definitely marking this down in the "I should have known better" category. If you use MSSQL, you probably know by know that "user" is a reserved word. So, unless you use [user] as a table identifier it's imperative that you name your table something like "tbl_user" or use the plural "users". I don't like plural table names, so I opted for tbl_user. I just ran into a gotcha with my TQL for a query against tbl_user. Why? Here's a snippet from my method to check the uniqueness of a user e-mail.
// local vars struct
var local = StructNew();
// default result
local.result = false;
// tql for list
local.tql = "from user.User as user where user.Email = :Email AND user.Id != :Id";
//create a query object
local.query = getTransfer().createQuery(local.tql);
//set the named parameters
local.query.setParam("Email", getEmail(), "string");
local.query.setParam("Id", getId(), "numeric");
//run it
local.userList = getTransfer().listByQuery(local.query);
// if no records exist e-mail passes unique test
if (local.userList.recordcount eq 0)
{
local.result = true;
}
return local.result;
My transfer object class name is user.User, so why not alias that as "user"? That's a logical alias, right? Wrong!
After pulling my hair out debugging the ever-so-descriptive error message,
local.tql = "from user.User where user.User.Email = :Email AND user.User.Id != :Id";The other big a-ha moment for me is that if an error occurs within a method invocation, I should debug by unit testing, not re-initializing, rinsing and repeating on the client side.
Working with Transfer ORM: An Event Model Example
Posted by Paul Marcotte | Tags: ColdFusion , ColdSpring , Transfer
If you use Transfer ORM you may have seen Mark Mandel's Advanced Transfer ORM Techniques presentation. One of the most interesting portions of this presentation (for me) was his coverage of the Transfer Event Model. Mark demonstrates how to setup a service (in this case a CryptService) as a Transfer Event listener. There are several events that objects can register to as listeners. One event type is "AfterNew", which is fired when a new transfer object is created. In the presentation Mark demonstrates how to leverage the Event Model with an AfterNew event and a decorated transfer object to encrypt/decrypt a user password. I wanted to use this concept for a new project, but rather than copying code verbatim from the presentation, I decided to try something a little different.Scaffolding a Generic Admin - Part 6 - Bean, Form and List Views - The Finale
Posted by Paul Marcotte | Tags: ColdSpring , Dispatcher , Illudium , Transfer
In this post I'll provide a deeper insight into how Dispatcher works and introduce the three generic views that make up the "generic admin". After generating some code with Illudium, we'll have all the pieces to perform CRUD operations...Scaffolding a Generic Admin - Part 5 - Dispatcher, Transfer and ColdSpring Setup and Config
Posted by Paul Marcotte | Tags: ColdSpring , Dispatcher , Transfer
I introduced a lot of pieces to the puzzle during parts 1 through 4 of this series and with this post, I hope to put them together. We'll look at a file and folder setup, ColdSpring and Transfer XML configuration files and the other files that form application for the generic admin...