Vic,

I will be glad to submit the changes to the project on sourceforge.  We have
made several extensions to the original BaseDAO design, which we got from
you back in 12/01 at the training class.  I will need to retrofit the
changes I have made to the BaseDAO here into the one in the webPIM project
and test them.  Once complete, I will submit the change for inclusion in the
basejDAO project.

Regards,

Todd

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Vic C.
Sent: Tuesday, June 11, 2002 3:52 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [MVC-Programmers] BaseDAO and Update




Todd G. Nist wrote:
> Hello all,
>
> I have a question with regards to the update method of the BaseDAO class
> found in the WebPIM application.  As it is currently written it would
appear
> to allow for writes of dirty data.  That is to say that if two users read
> the same  record, lets say company record, and user1 changes the company
> field to "XYZ" and User2 changes it to "AAAAA", if user2 commits his
record
> and then user1 commits his, user2's changes will be lost.  No exception is
> thrown since the update just does an update where the id is equal to the
> value of the id of the crs.getBigDecimal("id") of the current row.
>
> Am I missing something here or is this an issue/bug with the current
> implementation?  If the update was being applied to the CRS and then the
> crs.acceptChanges() method applied, the CRS would handle comparing the
> contents of the CRS to the actual db prior to committing the changes, but
> since a new connection is obtained and a standard update applied, there is
> no support for concurrency.  It seems that there either needs to be a
> version field on all tables which is included in the update statement of
the
> prepareUpdateSQL method which does something like below:
>
>       UPDATE theTable SET version=<newversion> [and other fields] WHERE
>       [criteria] AND VERSION=<oldversion>
>
>       where <oldversion> is the version is the version from the crs current
row,
> and
>       <newversion>=<oldversion>+1.
>
>
> In this way if two users update the same record of a table at roughly the
> same time, the first ones changes will be committed, but the second ones
> will generate an error which can be caught and the end user notified of
for
> corrective action.
>
> Any thoughts on this?

You are correct! It should check fields and it will.

>
> I have modified the BaseDAO to support multiple tables rather then one as
it
> currently does.  This opens up another issue of transactional integrity.
If
> a crs is created from a join between two or more tables, one needs to
start
> a transaction to support the individual updates as one unit of work.   I
> have added methods to support transactions to ensure that if the crs has
> data from more then one table that either all changes are committed or
none
> are.
>
> Any thoughts on this?
>

You are correct! (alternative is a bean that contains a bean that each
have DAO)
If you would like to contribute source to the DAO with several other
developers, I have added it to sourceforge under basejDAO. I will post
the initial code. Just add yourself to the developers list.


> Regards,
>
> Todd G. Nist
>
>

_______________________________________________
MVC-Programmers mailing list
[EMAIL PROTECTED]
http://www.basebeans.com:8081/mailman/listinfo/mvc-programmers


begin 666 ATT00023.htm
M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#,N,B\O
M14XB/@T*/$A434P^#0H\2$5!1#X-"CQ-151!($A45% M15%5258](D-O;G1E
M;G0M5'EP92(@0T].5$5.5#TB=&5X="]H=&UL.R!C:&%R<V5T/5=I;F1O=W,M
M,3(U,B(^#0H\345402!.04U%/2)'96YE<F%T;W(B($-/3E1%3E0](DU3($5X
M8VAA;F=E(%-E<G9E<B!V97)S:6]N(#8N,"XU-S8R+C,B/@T*/%1)5$Q%/E)%
M.B!;359#+5!R;V=R86UM97)S72!"87-E1$%/(&%N9"!5<&1A=&4\+U1)5$Q%
M/@T*/"](14%$/@T*/$)/1%D^#0H\(2TM($-O;G9E<G1E9"!F<F]M('1E>'0O
M<&QA:6X@9F]R;6%T("TM/@T*#0H\4#X\1D].5"!325I%/3(^5FEC+#PO1D].
M5#X-"CPO4#X-"@T*/% ^/$9/3E0@4TE:13TR/DD@=VEL;"!B92!G;&%D('1O
M('-U8FUI="!T:&4@8VAA;F=E<R!T;R!T:&4@<')O:F5C="!O;B!S;W5R8V5F
M;W)G92XF;F)S<#L@5V4@:&%V92!M861E('-E=F5R86P@97AT96YS:6]N<R!T
M;R!T:&4@;W)I9VEN86P@0F%S941!3R!D97-I9VXL('=H:6-H('=E(&=O="!F
M<F]M('EO=2!B86-K(&EN(#$R+S Q(&%T('1H92!T<F%I;FEN9R!C;&%S<RXF
M;F)S<#L@22!W:6QL(&YE960@=&\@<F5T<F]F:70@=&AE(&-H86YG97,@22!H
M879E(&UA9&4@=&\@=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T9/3E0^#0H-"CQ"4CX\1D].5"!3
M25I%/3(^/$$@2%)%1CTB:'1T<#HO+W=W=RYB87-E8F5A;G,N8V]M.C@P.#$O
M;6%I;&UA;B]L:7-T:6YF;R]M=F,M<')O9W)A;6UE<G,B/FAT=' Z+R]W=W<N
M8F%S96)E86YS+F-O;3HX,#@Q+VUA:6QM86XO;&ES=&EN9F\O;79C+7!R;V=R
K86UM97)S/"]!/CPO1D].5#X-"CPO4#X-"@T*/"]"3T19/@T*/"](5$U,/@``
`
end

_______________________________________________
MVC-Programmers mailing list
[EMAIL PROTECTED]
http://www.basebeans.com:8081/mailman/listinfo/mvc-programmers

Reply via email to