db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dressler, Erik(externe MA)" <Erik.Dress...@Dresdner-Bank.lu>
Subject criteria and criterion
Date Mon, 09 May 2005 16:05:48 GMT

hi!

it's me again!!!

i have to build a criteria-object, but i do not know, how much where-clauses
i have to add. it differs as the case arises.

the select statement could look like this:

select max(value) from testtable
where (column1 = 1 and column2 = 1000)
or (column1 = 2 and column2 = 1000)
or (column1 = 3 and column2 = 1000)
or (column1 = 4 and column2 = 1000)

the values of column1 are stored in a vector. my code looks like this:

String selectColumn = "TESTPEER.VALUE";
Criteria crit = new Criteria();
crit.addSelectColumn("MAX(" + selectColumn + ")");
		
for(int i = 0; i < valueVec.size(); i++)
{
	Criteria.Criterion a = crit.getNewCriterion(column1,
valueVec.elementAt(i), Criteria.EQUAL);

	Criteria.Criterion b = crit.getNewCriterion(column2, "1000",
Criteria.EQUAL);
	crit.add(a.and(b));
}

how do i manage the or-clause, when i do not know, how much values are
stored in the vector???

best regards, erik dressler
 
*  *  *  *  *  *  D I S C L A I M E R  *  *  *  *  *  *  *
 
This message is confidential and intended for the named addressee(s) only.
If you are not the intended recipient, please contact the sender by E-Mail
return and then delete this message from your system. You should not copy
or use it or disclose its contents to any other person.
 
If any part of this message is illegible or if you suspect that the message
may have been intercepted or amended, please contact the sender.
Dresdner Bank Luxembourg S.A. cannot accept any responsibility for the
accuracy or completeness of this message without further investigation.
 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message