I'm completely lost with a problem. I'm trying to select data
dynamically. To do this, I've a List<string> containing the columns I
want to select, which I pass into the sql statement and use the
iterate tag to populate this in the sql statment.
This looks like:
SELECT
<iterate property="columns" conjunction="," open="" close="">
$columns[]$
</iterate>
FROM my_table
WHERE ...
My table contains the following columns (simplified): AdvertiserId,
Impression, Clicks (all integer)
When I populate the List I'm passing in with the first 2 columns, it
works fine. When I restart my program en add all 3 columns, it still
works fine.
But, if I run the query with the first 2 columns, add the last column
to the list en re-run the qeury again (without restarting), the
results are not mapped correctly. The strange thing is that the
results of Clicks are mapped to Impressions, and Clicks is always 0.
I'm using ResultClass="MyObject", because of the dynamic result I
can't use a ResultMap. Any idea what could be causing this? I don't
use any caching.
Another strange thing, when I change the ResultClass to Hashtable, I
can see that all correct property names have the correct values...
Are you using a ResultMap? As of right now if you use a ResultMap and you have that third column mapped but it isn't in your Select Statement, it will fail.
On Tue, Oct 11, 2011 at 6:26 AM, Danny Stommen <da...@bannerconnect.net>wrote:
> I'm completely lost with a problem. I'm trying to select data > dynamically. To do this, I've a List<string> containing the columns I > want to select, which I pass into the sql statement and use the > iterate tag to populate this in the sql statment.
> This looks like: > SELECT > <iterate property="columns" conjunction="," open="" close=""> > $columns[]$ > </iterate> > FROM my_table > WHERE ...
> My table contains the following columns (simplified): AdvertiserId, > Impression, Clicks (all integer)
> When I populate the List I'm passing in with the first 2 columns, it > works fine. When I restart my program en add all 3 columns, it still > works fine.
> But, if I run the query with the first 2 columns, add the last column > to the list en re-run the qeury again (without restarting), the > results are not mapped correctly. The strange thing is that the > results of Clicks are mapped to Impressions, and Clicks is always 0.
> I'm using ResultClass="MyObject", because of the dynamic result I > can't use a ResultMap. Any idea what could be causing this? I don't > use any caching.
> Another strange thing, when I change the ResultClass to Hashtable, I > can see that all correct property names have the correct values...
No, as metioned in my first post, I'm using ResultClass because I
don't know in advance which column are requested.
I simplified my explanation to 3 columns, but the actual table is
containing 12 columns. Because this is a rather large reporting table,
I want to prevent that each time all columns are retrieved.
On Oct 11, 3:45 pm, Michael McCurrey <mmccur...@gmail.com> wrote:
> Are you using a ResultMap? As of right now if you use a ResultMap and you
> have that third column mapped but it isn't in your Select Statement, it will
> fail.
> On Tue, Oct 11, 2011 at 6:26 AM, Danny Stommen <da...@bannerconnect.net>wrote:
> > Hi All,
> > I'm completely lost with a problem. I'm trying to select data
> > dynamically. To do this, I've a List<string> containing the columns I
> > want to select, which I pass into the sql statement and use the
> > iterate tag to populate this in the sql statment.
> > This looks like:
> > SELECT
> > <iterate property="columns" conjunction="," open="" close="">
> > $columns[]$
> > </iterate>
> > FROM my_table
> > WHERE ...
> > My table contains the following columns (simplified): AdvertiserId,
> > Impression, Clicks (all integer)
> > When I populate the List I'm passing in with the first 2 columns, it
> > works fine. When I restart my program en add all 3 columns, it still
> > works fine.
> > But, if I run the query with the first 2 columns, add the last column
> > to the list en re-run the qeury again (without restarting), the
> > results are not mapped correctly. The strange thing is that the
> > results of Clicks are mapped to Impressions, and Clicks is always 0.
> > I'm using ResultClass="MyObject", because of the dynamic result I
> > can't use a ResultMap. Any idea what could be causing this? I don't
> > use any caching.
> > Another strange thing, when I change the ResultClass to Hashtable, I
> > can see that all correct property names have the correct values...
> No, as metioned in my first post, I'm using ResultClass because I > don't know in advance which column are requested.
> I simplified my explanation to 3 columns, but the actual table is > containing 12 columns. Because this is a rather large reporting table, > I want to prevent that each time all columns are retrieved.
> On Oct 11, 3:45 pm, Michael McCurrey <mmccur...@gmail.com> wrote: > > Are you using a ResultMap? As of right now if you use a ResultMap and > you > > have that third column mapped but it isn't in your Select Statement, it > will > > fail.
> > On Tue, Oct 11, 2011 at 6:26 AM, Danny Stommen <da...@bannerconnect.net > >wrote:
> > > Hi All,
> > > I'm completely lost with a problem. I'm trying to select data > > > dynamically. To do this, I've a List<string> containing the columns I > > > want to select, which I pass into the sql statement and use the > > > iterate tag to populate this in the sql statment.
> > > My table contains the following columns (simplified): AdvertiserId, > > > Impression, Clicks (all integer)
> > > When I populate the List I'm passing in with the first 2 columns, it > > > works fine. When I restart my program en add all 3 columns, it still > > > works fine.
> > > But, if I run the query with the first 2 columns, add the last column > > > to the list en re-run the qeury again (without restarting), the > > > results are not mapped correctly. The strange thing is that the > > > results of Clicks are mapped to Impressions, and Clicks is always 0.
> > > I'm using ResultClass="MyObject", because of the dynamic result I > > > can't use a ResultMap. Any idea what could be causing this? I don't > > > use any caching.
> > > Another strange thing, when I change the ResultClass to Hashtable, I > > > can see that all correct property names have the correct values...
> Interesting, can you post an example of it failing? Either your SqlMap & > Class or a failing test?
> On Wed, Oct 12, 2011 at 1:56 AM, Danny Stommen <da...@bannerconnect.net>wrote:
>> No, as metioned in my first post, I'm using ResultClass because I >> don't know in advance which column are requested.
>> I simplified my explanation to 3 columns, but the actual table is >> containing 12 columns. Because this is a rather large reporting table, >> I want to prevent that each time all columns are retrieved.
>> On Oct 11, 3:45 pm, Michael McCurrey <mmccur...@gmail.com> wrote: >> > Are you using a ResultMap? As of right now if you use a ResultMap and >> you >> > have that third column mapped but it isn't in your Select Statement, it >> will >> > fail.
>> > On Tue, Oct 11, 2011 at 6:26 AM, Danny Stommen <da...@bannerconnect.net >> >wrote:
>> > > Hi All,
>> > > I'm completely lost with a problem. I'm trying to select data >> > > dynamically. To do this, I've a List<string> containing the columns I >> > > want to select, which I pass into the sql statement and use the >> > > iterate tag to populate this in the sql statment.
>> > > My table contains the following columns (simplified): AdvertiserId, >> > > Impression, Clicks (all integer)
>> > > When I populate the List I'm passing in with the first 2 columns, it >> > > works fine. When I restart my program en add all 3 columns, it still >> > > works fine.
>> > > But, if I run the query with the first 2 columns, add the last column >> > > to the list en re-run the qeury again (without restarting), the >> > > results are not mapped correctly. The strange thing is that the >> > > results of Clicks are mapped to Impressions, and Clicks is always 0.
>> > > I'm using ResultClass="MyObject", because of the dynamic result I >> > > can't use a ResultMap. Any idea what could be causing this? I don't >> > > use any caching.
>> > > Another strange thing, when I change the ResultClass to Hashtable, I >> > > can see that all correct property names have the correct values...
>> > -- >> > Michael J. McCurrey >> > Read with me athttp://www.mccurrey.comhttp:// >> chaoticmindramblings.blogspot.com/
> On Wed, Oct 12, 2011 at 2:15 PM, Michael McCurrey <mmccur...@gmail.com>wrote:
> > Interesting, can you post an example of it failing? Either your SqlMap &
> > Class or a failing test?
> > On Wed, Oct 12, 2011 at 1:56 AM, Danny Stommen <da...@bannerconnect.net>wrote:
> >> No, as metioned in my first post, I'm using ResultClass because I
> >> don't know in advance which column are requested.
> >> I simplified my explanation to 3 columns, but the actual table is
> >> containing 12 columns. Because this is a rather large reporting table,
> >> I want to prevent that each time all columns are retrieved.
> >> On Oct 11, 3:45 pm, Michael McCurrey <mmccur...@gmail.com> wrote:
> >> > Are you using a ResultMap? As of right now if you use a ResultMap and
> >> you
> >> > have that third column mapped but it isn't in your Select Statement, it
> >> will
> >> > fail.
> >> > On Tue, Oct 11, 2011 at 6:26 AM, Danny Stommen <da...@bannerconnect.net
> >> >wrote:
> >> > > Hi All,
> >> > > I'm completely lost with a problem. I'm trying to select data
> >> > > dynamically. To do this, I've a List<string> containing the columns I
> >> > > want to select, which I pass into the sql statement and use the
> >> > > iterate tag to populate this in the sql statment.
> >> > > My table contains the following columns (simplified): AdvertiserId,
> >> > > Impression, Clicks (all integer)
> >> > > When I populate the List I'm passing in with the first 2 columns, it
> >> > > works fine. When I restart my program en add all 3 columns, it still
> >> > > works fine.
> >> > > But, if I run the query with the first 2 columns, add the last column
> >> > > to the list en re-run the qeury again (without restarting), the
> >> > > results are not mapped correctly. The strange thing is that the
> >> > > results of Clicks are mapped to Impressions, and Clicks is always 0.
> >> > > I'm using ResultClass="MyObject", because of the dynamic result I
> >> > > can't use a ResultMap. Any idea what could be causing this? I don't
> >> > > use any caching.
> >> > > Another strange thing, when I change the ResultClass to Hashtable, I
> >> > > can see that all correct property names have the correct values...
> >> > --
> >> > Michael J. McCurrey
> >> > Read with me athttp://www.mccurrey.comhttp:// > >> chaoticmindramblings.blogspot.com/
> > On Wed, Oct 12, 2011 at 2:15 PM, Michael McCurrey <mmccur...@gmail.com>wrote:
> > > Interesting, can you post an example of it failing? Either your SqlMap &
> > > Class or a failing test?
> > > On Wed, Oct 12, 2011 at 1:56 AM, Danny Stommen <da...@bannerconnect.net>wrote:
> > >> No, as metioned in my first post, I'm using ResultClass because I
> > >> don't know in advance which column are requested.
> > >> I simplified my explanation to 3 columns, but the actual table is
> > >> containing 12 columns. Because this is a rather large reporting table,
> > >> I want to prevent that each time all columns are retrieved.
> > >> On Oct 11, 3:45 pm, Michael McCurrey <mmccur...@gmail.com> wrote:
> > >> > Are you using a ResultMap? As of right now if you use a ResultMap and
> > >> you
> > >> > have that third column mapped but it isn't in your Select Statement, it
> > >> will
> > >> > fail.
> > >> > On Tue, Oct 11, 2011 at 6:26 AM, Danny Stommen <da...@bannerconnect.net
> > >> >wrote:
> > >> > > Hi All,
> > >> > > I'm completely lost with a problem. I'm trying to select data
> > >> > > dynamically. To do this, I've a List<string> containing the columns I
> > >> > > want to select, which I pass into the sql statement and use the
> > >> > > iterate tag to populate this in the sql statment.
> > >> > > My table contains the following columns (simplified): AdvertiserId,
> > >> > > Impression, Clicks (all integer)
> > >> > > When I populate the List I'm passing in with the first 2 columns, it
> > >> > > works fine. When I restart my program en add all 3 columns, it still
> > >> > > works fine.
> > >> > > But, if I run the query with the first 2 columns, add the last column
> > >> > > to the list en re-run the qeury again (without restarting), the
> > >> > > results are not mapped correctly. The strange thing is that the
> > >> > > results of Clicks are mapped to Impressions, and Clicks is always 0.
> > >> > > I'm using ResultClass="MyObject", because of the dynamic result I
> > >> > > can't use a ResultMap. Any idea what could be causing this? I don't
> > >> > > use any caching.
> > >> > > Another strange thing, when I change the ResultClass to Hashtable, I
> > >> > > can see that all correct property names have the correct values...
> > >> > --
> > >> > Michael J. McCurrey
> > >> > Read with me athttp://www.mccurrey.comhttp:// > > >> chaoticmindramblings.blogspot.com/