You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Hamza Rana <Ha...@esstec.com.pk> on 2002/01/04 14:30:14 UTC
Why populateObject not considering CRITERIA?
hi
i came across this code (i beleive you guys would have also)
------------------------Code--------------------------------
public static void populateObject (Record row,
int offset,
Business obj )
throws Exception
{
obj.setBusinessid(
new StringKey(row.getValue(offset+0).asString()));
obj.setBusinesstypeid(row.getValue(offset+1).asInt());
obj.setStatus(row.getValue(offset+2).asInt());
obj.setPassword(row.getValue(offset+3).asString());
obj.setNumberofusers(row.getValue(offset+4).asInt());
obj.setBusinessname(row.getValue(offset+5).asString());
obj.setBusinessemail(row.getValue(offset+6).asString());
}
----------------------End Of Code-----------------------------
Now why this method not taking Criteria Selected Columns in
consideration??? i m gettin excpetion due to this method.:O
please tell me a work out for this situation .. regards - thanks in
Advance...
Hamza
-----Original Message-----
From: Hamza Rana
Sent: Friday, January 04, 2002 6:25 PM
To: Turbine Users List
Subject: RE:Trouble with LIMIT in CRITERIA, any solution ???
hi every one..
i did one thing and guess what .. the code worked with limit.. and that
suggests that the following code in Base*Peer do somtihng wrong with
Criteria fro LIMIT
if (criteria.getSelectColumns().size() == 0)
{
addSelectColumns ( criteria );
}
coz when criteria.getSelectColumns().size() != 0 the code run fine
as i did this
Vector v = (Vector)BusinessPeer.doSelect(crit);
System.out.println(crit.toString());
System.out.println(v.size());
crit.setLimit(2);
crit.setOffset(4);
v = (Vector)BusinessPeer.doSelect(crit);
System.out.println(crit.toString());
System.out.println(v.size());
and this code outputs correct value in next execution..:O
and btw... when i do this
crit.addSelectColumn(BusinessPeer.BUSINESSID);
it raises an exception :O... what if i only want to get only
BusinessID's filled in the Vector for Data objects???
please help me in this . Thanks in Advance...
rEgards
Hamza
-----Original Message-----
From: Hamza Rana
Sent: Friday, January 04, 2002 3:48 PM
To: Trubine (E-mail)
Subject: Trouble with LIMIT in CRITERIA, any solution ???
Hi ,
the result return after calling doSelect(Criteria ) has no impact when i
apply setOffset() and setLimit() to its criteria. Does ne one knwo ne
work out to it?
here is the code i m using
Business myBiz = new Business();
Criteria crit= new Criteria();
crit.setLimit(2);
crit.setOffset(2);
try{
Vector v = (Vector)BusinessPeer.doSelect(crit);
System.out.println(v.size());
}
and its printing 4..:O
please help me out in this problem. although when i call crit.toString()
it gives
Current Query SQL (may not be complete or applicable): SELECT FROM
LIMIT 2, 2
Thanks in advance....
regards
Hamza
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Why populateObject not considering CRITERIA?
Posted by John McNally <jm...@collab.net>.
Peers take care of adding the appropriate columns to populate the
object. If you are wanting to select an arbitrary set of columns use
BasePeer.doSelectVillageRecords.
john mcnally
Hamza Rana wrote:
>
> hi
> i came across this code (i beleive you guys would have also)
>
> ------------------------Code--------------------------------
> public static void populateObject (Record row,
> int offset,
> Business obj )
> throws Exception
> {
>
> obj.setBusinessid(
> new StringKey(row.getValue(offset+0).asString()));
> obj.setBusinesstypeid(row.getValue(offset+1).asInt());
> obj.setStatus(row.getValue(offset+2).asInt());
> obj.setPassword(row.getValue(offset+3).asString());
> obj.setNumberofusers(row.getValue(offset+4).asInt());
> obj.setBusinessname(row.getValue(offset+5).asString());
> obj.setBusinessemail(row.getValue(offset+6).asString());
> }
> ----------------------End Of Code-----------------------------
>
> Now why this method not taking Criteria Selected Columns in
> consideration??? i m gettin excpetion due to this method.:O
> please tell me a work out for this situation .. regards - thanks in
> Advance...
> Hamza
>
>
> -----Original Message-----
> From: Hamza Rana
> Sent: Friday, January 04, 2002 6:25 PM
> To: Turbine Users List
> Subject: RE:Trouble with LIMIT in CRITERIA, any solution ???
>
> hi every one..
> i did one thing and guess what .. the code worked with limit.. and that
> suggests that the following code in Base*Peer do somtihng wrong with
> Criteria fro LIMIT
>
> if (criteria.getSelectColumns().size() == 0)
> {
> addSelectColumns ( criteria );
> }
> coz when criteria.getSelectColumns().size() != 0 the code run fine
> as i did this
> Vector v = (Vector)BusinessPeer.doSelect(crit);
> System.out.println(crit.toString());
> System.out.println(v.size());
> crit.setLimit(2);
> crit.setOffset(4);
>
> v = (Vector)BusinessPeer.doSelect(crit);
> System.out.println(crit.toString());
> System.out.println(v.size());
>
> and this code outputs correct value in next execution..:O
> and btw... when i do this
>
> crit.addSelectColumn(BusinessPeer.BUSINESSID);
> it raises an exception :O... what if i only want to get only
> BusinessID's filled in the Vector for Data objects???
> please help me in this . Thanks in Advance...
>
> rEgards
> Hamza
>
> -----Original Message-----
> From: Hamza Rana
> Sent: Friday, January 04, 2002 3:48 PM
> To: Trubine (E-mail)
> Subject: Trouble with LIMIT in CRITERIA, any solution ???
>
> Hi ,
> the result return after calling doSelect(Criteria ) has no impact when i
> apply setOffset() and setLimit() to its criteria. Does ne one knwo ne
> work out to it?
> here is the code i m using
> Business myBiz = new Business();
> Criteria crit= new Criteria();
> crit.setLimit(2);
> crit.setOffset(2);
>
> try{
> Vector v = (Vector)BusinessPeer.doSelect(crit);
> System.out.println(v.size());
> }
> and its printing 4..:O
> please help me out in this problem. although when i call crit.toString()
> it gives
> Current Query SQL (may not be complete or applicable): SELECT FROM
> LIMIT 2, 2
> Thanks in advance....
>
> regards
> Hamza
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>