I do this but with one exception, I copy it from the application scope to a
local scope then do the inserts, updates, etc. I think if you left it in
the application scope then you probably would need to do a cflock and that
would seem to lead to contribute to issues when a query might take awhile to
run and multiple users are trying to do things at the same time.
On 3/22/06, Troy Simpson <[EMAIL PROTECTED]> wrote:
>
> I do a lot of different things and it is hard to keep up with it all.
> So forgive me for having a little brain hickup with this one, but I
> just want to verify that I understand this correctly.
>
> If I create a DAO in application scope, could I use the same DAO for
> CRUD operations on all records being access by different sessions?
>
> For example, does anyone see a problem with doing this?
>
> At application startup call this in application.cfm:
> application.dao = createObject("component","some.dao");
>
> session 1 might call something like this:
> dao.read(session.record);
>
> session 2 might call something like this:
> dao.update(session.record);
>
> session 3 might call something like this:
> dao.read(session.record);
>
> session.record could be a structure or bean or something like that.
>
> All of these calls may occur at the same time. Does anyone see any
> problems of all sessions using the same dao instance?
>
> The reason, I am asking is because I would like to create a factory
> that would create one instance of some objects like a dao, gateway,
> logger, etc. and seperate instances for other type of objects like
> user, record, useraddress, other beans, etc.
>
> --
> Thanks,
> Troy
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236018
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54