Tnx Angus. I think you have the same opinion as I have as to returning object lists instead of queries. I am now thinking of something like this:
If I have a table "Person" and a table "Division" with table Person containing a link to Division (Person.divisionid) I am being tempted to do something like this in CF when returning "Give me all Persons"; 1. SQL is a join between Person and Division 2. Get that result in CF 3. Create a new Array which will be ultimately returned to Flex 4. For each row in the result, create a Person object AND a Division object 5. Add those object to the result Array (Array.push([Person,Division]); So each Row I get in Flash contains two typed Objects. Does this seem logical to you? If I understand you correctly, you are using a special Object for the adding to the array. Say an PersonDevision object, which consists of a Person and a Division object. That is a great way too, because everything is typed in that way. The only problem I see with it, is that it might be hard to let a CodeGenerator create all the possible combi-objects for the database. How did you solve that? Or is it that you do not explicitly use a 1 to 1 coupling between tables and your objects? So that means every class is always hand coded right? Tnx, It's great to get some other people's opinions on this subject like yours and Brandons. Ben 2007/3/22, Angus Johnson <[EMAIL PROTECTED]>:
My preference is to return an array of value objects, so yes I hardly ever return a query unless it's going to end up in a pretty dumb list. I'm careful with the number of records returned from a query though. You don't want to slavishly build value objects for thousands of records. Use blockfactor or narrow your criteria to return a smaller recordset. Implement paging if you need to. I've also found that you should avoid using getters and setters in server side value objects as they are slower than just setting public variables ie THIS scope. I always build client value objects as the code assist for their properties is a huge time saver and of course the strong typing catches all the silly typos. I don't know what your modelling but it's perfectly acceptable to build a value object representing a join. Most of our value objects are populated from data drawn from many different tables. I recently built a project where I first returned XML containing lots of elements (records) and then did parsing / building of value objects on the client. I wasn't happy with the speed so I did the parsing on the server and returned an array collection of value objects instead of XML. It was noticably faster. So yeah my preference is to return strongly typed objects in an array. HTH Angus On 22 Mar 2007 12:49:41 -0700, Brendan Meutzner <[EMAIL PROTECTED]> wrote: > > Ben, > > Have you looked into the CF Connectivity wizards for creating cfc's to > represent your AS object types? This is the way you're going to maintain > the "object" properties between server and client side. If you'd like, I > can blog an example of what I'm talking about. > > Brendan > > > > On 21 Mar 2007 15:31:39 -0700, Ben < [EMAIL PROTECTED]> wrote: > > > > Hi all, The message below was originally send to flashcoders > > mailinglist, but later I figured it might be better of on Flexcoders. > > > > Ben > > > > ----- > > > > I am wondering how people are solving the following issue in the real > > world. > > > > I am struggling to understand Flash Remoting with Coldfusion. I know > > it > > should make my life a whole lot easier but at the moment it's not > > reallyh helping :) All of the examples I find on the net are too > > straightforward; select a table query and return that to flash (or in > > my > > case flex). > > > > But in my situation, I want to return a joined recordset. How do I > > return that recordset while maintaining the advantages of "object on > > server is object in client"? I can return the whole query without > > problems of course (plain old returntype=query) but what do I do after > > I > > get that recordset in flash/flex? Is it still nescesarry to parse out > > that resultset to make objects out of the recordset? Wouldn't that > > defeat the whole purpose of remoting? (I used to do that in my xml > > communication days too). > > > > While I am busy, might as well ask the following question to the > > Coldfusion Remoting guru's out there too: What is best practice to let > > CF retujrn to Flash? In code examples I see a lot of 'query' being > > returned. But doesn't this go against the purpose of communicating > > only > > "Objects" between the two layers? In my head I have this image of > > letting Coldfusion return an Array of (e.g.) Person objects, when I > > execute a (e.g.) getPerson command. > > > > Tnx for any insights in advance, > > > > Ben > > > > > > -- > Brendan Meutzner > Stretch Media - RIA Adobe Flex Development > [EMAIL PROTECTED] > http://www.stretchmedia.ca > >

