Hi,

Thanks for your reply. I think I failed to share my objective clearly with
you.
What we are planning to do is
        1. Create a DB Table with two columns
                {ID  VARCHAR2(20)
                 SQL_STMT VARCHAR2(1000)}
        2. Register the SQL statement with an ID in DB
                For Example for a Customer Drop Down generation I will have
a record like
                ID- CUSTDD001
                SQL_STMT - SELECT Cust_Cd,Cust_Nm from Customer 
        3. Write a Custom Tag Which will take this ID as an Argument
        4. Custom Tag will retrieve the SQL_STMT based on ID ,then execute a
loop on the resultset 
            and return an HTML output like 
            <SELECT >
                        <option value="CustCd1">CustNm1
                        <option value="CustCd1">CustNm1
                        <option value="CustCd1">CustNm1
            </SELECT>
        
        This looks a deviation from Model 2 Approach.

        So alternatively I was thinking to populate some Collection using
some standard Method defined and then pass
this collection to Custom Tag. This is definitely a good approach in
Architecture sense.But if I consider the performance factor this looks a bit
expensive. Reason is simple, I need to run the SQL and execute a loop on
ResultSet to create the Collection. Then in the custom Tag I need to run
another loop on Collection to generate HTML.This effect can be really
considerable in case of pages with many DropDowns.
        Returning resultset is another option which will leave me Statement
unclosed. I heard somwhere that ResultSet can be assigned to RowSet without
any loops. Also I can close the Statement and return the connection.
Hope this will explain my situation better.Pls advise.

Thanks & Regards
Savant
        




-----Original Message-----
From: V. Cekvenich [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 7:36 PM
To: [EMAIL PROTECTED]
Subject: Re: About RowSet


http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html as 
per google, or you can read the JavaDoc on rowset in Java Developers 
Connection on JavaSoft.com.

You should either use RowSet or Resultset, not sure of why mix.
RowSet extends ResultSet, major difference that former is a bean, that 
is you can say new RowSet(), thus making GC a bit easier for new 
developers who do not do the nested finally right for the ResultSet.

Since you are posting on Struts, I assume you would use existing tags, 
as opposed to writing tags.

There is a source code approach with "zero" copy on basicPortal.sf.net.
A DAO has a ROWSET. (or CommonsSQL - 2 ways)
A Bean has a DAO.
DAO is also an iterator, and Bean is also a Collection(advanced topic: 
even as your treat this bean for testing with bean properties, Struts 
sees it as a collection (iterator adaptor w getRow), so it can do multi 
row updates, for master detail processing).
You unit test the Bean, so it can be used by Console, Model1 use bean, etc.

The benefit of this design is that when a setter is fired by Struts, it 
is on the disconnected RowSet, thus Zero copy.
There are no VO, DTO, etc. objects that are GCed later, thus you can 
support more concurrent users per server.

Not sure what loops or populations you are talking about, but there is a 
rowset DAO w/ Struts on sf.net

Above is for any bean.

For options collection, you can create an collection of beans, with 2 
properties. Again, do not use Resultset for beans, and RowSet for 
options, it makes no sense.

hth,
.V

ot: I will soon have a DAO that also uses Commons SQL so you can chose 
RowSet or CommonSQL (else you write your own DAO, to say JDO)

Savantraj, Chennamakal Subramanian wrote:
> Hi,
> Could anyone share your experience in using RowSet to Transfer data from
> ResultSet?
> What is the significance difference using a rowset instead of our custom
> generated
> collection object or something like TableModel?
> What would be a better option for the following situation.
> 
> Objective
>       1. Create a Custom Tag which will generate a Table HTML Display
> based on a Result Set.
> Approach 1
>       1. Run the SQL
>       2. Populate Collection (RowSet/TableModel/Any other) from ResultSet
>       3. Pass the collection to Custom Tag
>       4. Custom Tag will generate <SELECT><Option></SELECT> based on the
> collection.
> 
> In the above scenario will I save any processing (Looping) if I use
RowSet?
> If I am using my own
> collection I need to run Loop 1 to create the collection and Loop 2 inside
> Custom Tag to generate
> HTML. RowSet looks like saving the first loop. But how it is internally
> doing? Is it the same way?
> 
> Pls provide your advice.
> 
> Thanks in advance
> 
> Best Regards
> Savant
>       
> 
> -------------------------------------------------------------------
> This email is confidential and intended only for the use of the individual
> or entity named above and may contain information that is privileged. If
you
> are not the intended recipient, you are notified that any dissemination,
> distribution or copying of this email is strictly prohibited. If you have
> received this email in error, please notify us immediately by return email
> or telephone and destroy the original message. Thank you. - This mail is
> sent via Sony Asia Pacific Mail Gateway. 
> -------------------------------------------------------------------




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

-------------------------------------------------------------------
This email is confidential and intended only for the use of the individual
or entity named above and may contain information that is privileged. If you
are not the intended recipient, you are notified that any dissemination,
distribution or copying of this email is strictly prohibited. If you have
received this email in error, please notify us immediately by return email
or telephone and destroy the original message. Thank you. - This mail is
sent via Sony Asia Pacific Mail Gateway. 
-------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to