Say I am writing a criteria equivalent to
 
select * from employee where salary < 10000 or salary > 20000
 
and I do this using
 

Criteria crit = new Criteria();Criteria.Criterion a1 = 
crit.getNewCriterion(EMPLOYEE.salary, 10000, Criteria.LESS_THAN);Criteria.Criterion a2 
= crit.getNewCriterion(EMPLOYEE.salary, 20000, 
Criteria.GREATER_THAN);crit.add(a1.or(a2));

Now there are two criterion on the same field ( or that's what i assume). Which 
criterion will getCriterion("EMPLOYEE.salary") return?

 

Thanks

Swami



Kalyani Kale <[EMAIL PROTECTED]> wrote:
Hi,
According to my understanding,

Both these methods essentially do the same thing. They return a criteria
associated with the column.

But in the getCriterion( String column ) method, the 'columnName' string is
of type 'tableName.columnName'. 

Whereas in the getCriterion( String tableName, String columnName ) method,
the table name is explicitly provided.

for e.g.
getCriteron("Employee.empid")
getCriterion("Employee", "empid")

Hope this helps.
Kalyani

-----Original Message-----
From: Swaminathan Gurumoorthy [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 07, 2004 1:56 PM
To: [EMAIL PROTECTED]
Subject: Newbie --> getCriterion() Question

Hi

I am trying out torque for my data persistence. I had a question.

The criteria class has two getCriterion() methods - one that takes a 
column and another that takes a table name and column name.

The javadoc was not very descriptive and so it was kinda confusing to 
find out the difference between these two.

Can somebody explain with a simple eg.

Appreciate it.

Swami



---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


                
---------------------------------
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.

Reply via email to