You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/06/03 21:40:02 UTC

Re: [MVC-Programmers] CachedRowSet - updates limited to single table

Subject: Re: [MVC-Programmers] CachedRowSet - updates limited to single table
From: Vic Cekvenich <vi...@basebeans.com>
 ===
A good use for Cached Row Set is as a disconnected collection of rows. I 
use it to store the data after I do a Select (instead of a collection)
A nice feature of RowSet is getMetaData method, that explains the 
information about the data. I create an update, or an insert or a delete 
I do so "manualy" and not use the RowSet.
I enumerate the meta data about each row, then I enumerate each column, 
and create for example a an Update SQL String / Prepared Statment.
Look at WebPIM for my Design. It is a generic update. It can be easily 
extended to do multi table, or you can overide the DAO and "hardcode" 
the join update().
Above is a good design.

An alternative design is this
Create a Company update Form
Create a  User update Form.
When selecting you can do a SQL join and use the JSTL or Display Tag.
When updating on a single screen....
    Well you can have multiple users on a page per company. So you would 
display company and users that iterate. Hence a company form bean that 
contains a user form beans (and each bean implements iterator).
So alternative is a formBean iterator that contains other formBean 
iterators (thata each have a DAO that uses a disconnected row set for a 
collection). Very clean, IMO.

Do not use crs.acceptChanges in either case.
Done all the time, most Forms in most applications are master detail or 
many to many or several at the same time.
HTH,
V.

Todd G. Nist wrote:

>Hello,
>
>We have a CachedRowSet which is created from a SQL statement which joins the
>User table to the Company table to display company information for the User.
>We allow the user of the system to select a record and drill in for
>updating.  Since the CachedRowSet was created with a join, it keeps throwing
>an exception when we apply the this.crs.acceptChanges(connection); method.
>I did not see anything in the CachedRowSet documentation which states that
>it only supports a single table.
>
>So does a CachedRowSet only support updating a single table or am I missing
>something?
>
>Thanks is advance.
>
>Regards,
>
>Todd G. Nist
>Email:   tnist@bellsouth.net
>
>
>  
>
> Hello,
>
> We have a CachedRowSet which is created from a SQL statement which 
> joins the User table to the Company table to display company 
> information for the User.  We allow the user of the system to select a 
> record and drill in for updating.  Since the CachedRowSet was created 
> with a join, it keeps throwing an exception when we apply the 
> this.crs.acceptChanges(connection); method.   I did not see anything 
> in the CachedRowSet documentation which states that it only supports a 
> single table. 
>
> So does a CachedRowSet only support updating a single table or am I 
> missing something?
>
> Thanks is advance.
>
> Regards,
>
> Todd G. Nist
> Email:   tnist@bellsouth.net
>
>_______________________________________________
>MVC-Programmers mailing list
>MVC-Programmers@basebeans.com
>http://www.basebeans.com:8081/mailman/listinfo/mvc-programmers
>
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>