You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Howard Lin <hl...@vonage.com> on 2001/06/27 23:41:15 UTC
exception when selecting one column using Criteria
I want to select one column ('foo') from a table ('bar') which has five
columns. The SQL is:
SELECT bar.foo from bar.
So I have the following:
Criteria c = new Criteria();
c.addSelectColumn(BarPeer.FOO);
BarPeer.doSelect(c);
The SQL generated by Criteria is what I want but I got the following
exception:
com.workingdogs.village.DataSetException: Only 1 columns exist!
at com.workingdogs.village.Record.getValue(Record.java:546)
at BaseBarPeer.populateObject(BaseBarPeer.java:165)
at BaseBarPeer.row2Object(BaseBarPeer.java:146)
at BaseBarPeer.populateObjects(BaseBarPeer.java:238)
at BaseBarPeer.doSelect(BaseBarPeer.java:174)
I'm using Oracle 8i and the column is not a primary key. It seems like
it's a village problem. But I couldn't find anything from village's
mailing list. Thanks in advance,
Howard Lin
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: exception when selecting one column using Criteria
Posted by John McNally <jm...@collab.net>.
That is an odd error, but if you are using torque generated peers
(BarPeer), it is going to add all 5 columns and not expect the one you
added to be there. You will end up with an Exception in the Peer after
you figure out this one. Except that it seems BarPeer did not add any
columns, hmmm.
Peers select the entire row. So many people want it otherwise yet no
one ever provides a solution. It has not been a big deal to me, but it
would be a nice feature, if you wish to be the one to add it.
john mcnally
Howard Lin wrote:
>
> I want to select one column ('foo') from a table ('bar') which has five
> columns. The SQL is:
> SELECT bar.foo from bar.
>
> So I have the following:
>
> Criteria c = new Criteria();
> c.addSelectColumn(BarPeer.FOO);
> BarPeer.doSelect(c);
>
> The SQL generated by Criteria is what I want but I got the following
> exception:
>
> com.workingdogs.village.DataSetException: Only 1 columns exist!
> at com.workingdogs.village.Record.getValue(Record.java:546)
> at BaseBarPeer.populateObject(BaseBarPeer.java:165)
> at BaseBarPeer.row2Object(BaseBarPeer.java:146)
> at BaseBarPeer.populateObjects(BaseBarPeer.java:238)
> at BaseBarPeer.doSelect(BaseBarPeer.java:174)
>
> I'm using Oracle 8i and the column is not a primary key. It seems like
> it's a village problem. But I couldn't find anything from village's
> mailing list. Thanks in advance,
>
> Howard Lin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org