I know there are at least two such generators publicly available, though I don't know where to find them. A search of the archives should turn up links. I know that several people (myself included) use non-public generators. I haven't written anything except SELECT statements in quite a long time, and those select statements are almost always big nasty multi-table one-off queries.
Such generators only deal with entity persistance, in general, because complex SELECT queries can't be defined by entity object properties and such. You could write something that would interpret some non-SQL language that defined the stuff you wanted and generate a SQL statement, but in general, the savings over time isn't particularly significant, an the initial workload is quite a lot. EJB's use a system like this. Having all your SELECT methods being implemented separatly is pretty much a necessary evil. Even if you use a generator, you still have to define each individual query using some other descriptor, so you're not really saving much. However, make sure that you're not going too far down the road of a query == a method. it should be a database operation == a method. In some senses, you methods are analogous in scope to stored procedures, just they're written in CF which is more familiar and less performant. cheers, barneyb On Wed, 17 Nov 2004 15:28:25 +1300, Tim Van Der Hulst <[EMAIL PROTECTED]> wrote: > > DAO --> Call it a day.. > > Thats great but I still want to know how people are handling DAO/SQL code > which was my original question. Java has numerous class generators for this > purpose but I don't see much if anything for coldfusion. In my original post > I suggested this was due to the ease of CFQuery but I still don't feel this > takes away from the tedium of writing database access code. It's time > consuming and boring.. > > I've gone for a very basic dynamic table access aproach and it saves loads of > time but feels a bit dirty and reading the various ideas raised about DAO's > and gateways left feeling somewhat of a noob. > > In an earlier post I said I avoided methods like: > > getAllActive() > getByOwner( ownerID ) > getAllPrecedingDate( date ) > > in favour of a generic select(condition) method. I say that just because it > is much easier and faster to hack together because i'm a sole developer. > Personally I'd rather have DAO classes with loads of methods as mentioned > above, however.. writing all those tedious methods is a PITA and best done by > a class generator as mentioned earlier. And it'd be nice if we had > autocomplete/dropdown listing of methods when accessing a CFC's in > dreamweaver or other favourite CFMX IDE (eg eclipse). Might already exist... > let me know ;) > > thanks folks, > > TiM > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/blog/ ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at [EMAIL PROTECTED]
