ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan Pablo Araya" <juanpablo.ar...@gmail.com>
Subject Re: Complex properties
Date Thu, 08 May 2008 23:48:09 GMT
Hi. For that case, you have two options:

- Filling the gridview with an object data source: in this case you
can create dirty classes that expand your base class (for ex: with
get, set propertys for FirstName, LastName). Using this, just use
joins in your iBatis.

- Filling with a datatable. In this case you must create an utilities
class that returns a DataTable. Filling in the gridview is the same as
in the ObjectDS. In this Grid you can configure the data from your
datatable, so in your method you can put whatever you want (fill the
rows with iList returned through iBatis, iterate through the list and
foreach record fill another rows with aditional data, like First Name,
Last Name, another things, etc.)

We decided to use the datatable because of his flexibility, sorting
and paging properties (the object data source AFAIK does not support
this features) and no use of dirty classes. The only problem I though
is the optimization: the datatable needs to iterate through the iList
and fill the rows, then the gridview iterates again. With the object
data source the iteration is just made once, and internally the
filling (I suspect) is much more efficient.

Greetings and sorry for my poor english!

2008/5/8 Bjorn I <bei1@rocketmail.com>:
> I'm trying to figure out the best way of returning my list of items to populate a gridview
in .Net.
> I have a table of items that contains among others a CreateUserID and LastUpdateUserID,
each a foreign key to the user table.
> I've created an item class that has 2 attributes of the user class. For the front end,
I would only need to display first name and last name, the rest of the user data is unecessary.
> The user info will not change very often, so I figured I could cache a user select statement.
Or should I just do a simple join to get the first name and last name?
> My table contains other foreign keys, such as StatusID etc. In previous applications
I would simply add a field to the class that can hold the text representation of StatusID,
and use a join in the sql statement, so I could easily bind the result to a .net control.
> In your oppionion, what is the best approach here? I have several pages that will need
to display tabular data, each having foreign key relations.
> Bjorn
>
>
>      ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>

Mime
View raw message