Jacob Hookom wrote:
>Hello All,
>
>I had a few questions that perturb me as to why DAO is so widely used:
>
>1. Some articles say it prevents the locking of DB tables, but we
>are never guaranteed that our data isn't dirty with the DB, and
>therefore, all application transactions are still executed against the
>DB.
>
>
Dao is only used to remove DAO out of the JavaBean. So Data and DAO are
separate. Most things are optimistic locking.
When a user selects a sees the data on the screen, some other user, out
of 1000's concurnet users could have change it. The user viewing could
go to lunch, etc.
It is a good practice to do optimistic and bad practice to do pesimistic
locking.
>2. Rule number one for selects is to only select the data you need.
>If I'm populating or pulling beans, more often than not, DAO
>implementations that I've seen pull out all columns from a table to
>populate their beans.
>
?? What DAO are you loking at? My DAO implementation (at baseBeans.com,
e-mail me for a password) does a SQL select statment that only selects
the hits into a DAO.
(I could argue that JDO and EJB or O/R (ex: TopLink) are not good
practices, since sites that implement them remove them, and are not
scalable)
Use roll your own beans with SQL.
>
>3. Thus far, the only advantage I've seen is on Row Gateway selects
>(public BeanObject select( Long primarykey )). Are there any others?
>
>
Not familiar with that one.
>If anyone can offer some insight on this, it would be greatly
>appreciated; I'm hurting myself on my current project with extensive DAO
>implementations that are shooting me in the foot at every turn with the
>requirements for specialized business logic.
>
>
Like you, at first I followed some PetStore type design paterns and had
similar experience.
Then I have had great production sucess with example demonstrated in
webPIM.
I like to unit test my beans (with IDE generated getters and setters)
with SQL based DAO (and DAO uses CachedRowSet for a dscicnected
presistance. Update is generic write one, uses meta data to enumerate
rows/ enumrate columns and makes a SQL statment atuomaticaly. )
HTH,
V.
>Best Regards,
>Jake Hookom
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>