Using a query doesn't mean you aren't programming in an OO fashion. You can keep your encapsulation while still returning a query or you could turn the query into an array of objects as you desire.
In your adminUserService you could have a method called GetAllAdminUsers that calls GetAllAdminUsers in your DAO. That query does a SELECT (your columns) FROM adminusertbl and returns that query result set to the Service. Now in your service you have a choice of how you want to return the data. You could return that query itself or you could return an array of objects. I tend to favor a method that will let you do either. You can pass in a returndatatype variable that says "I want a query" or "I want an array of objects". If the handler wants a query, just return that query (you can use a return type of Any on your GetAllAdminUsers method) or if it wants an array of objects, then you can loop over the query in your Service method and convert each query row to a struct (search for the UDF QueryRowToStruct) that you can then pass in to your adminUser bean to populate it. Then append it to your array and return it to the handler. What type of data structure you return is going to depend largely on what you are using it for. Some purists might argue that you should always return an array of objects because those objects have behavior associated with them. This is true in some cases. If you have helper methods on the objects that are useful in your application (like getName that concatenates the adminUser's first name and last name) then you should use the array of objects. If you are just going to return a simple list of records and only use it for displaying the information from the query, then you will likely be better off returning a query and using that. Either way, you are keeping most of your encapsulation in place and allow yourself a lot of flexibility to change how you get the admin users in the future without having to rewrite all of your app. Hope that helps, Judah On Wed, Aug 19, 2009 at 5:27 AM, Glyn Jackson<[email protected]> wrote: > > Thanks for the reply. reading my question back it did not make much sense, so > you did well to work out what I was on about lol! > >>I'd go with a query unless you have a particular reason not to. > > no reason, that would be the way I would normally do it, however if I wanted > to try and keep this strict OO like I was wondering how this would play out. > I can still access the service layer first(not server layer above lol) and > the query directly but it seems to brake the rules of OO some what and I > wondered how others do it. > > thanks for the link the site is down but will look at it when its back up. > > Glyn ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325541 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

