Hi.
Im using this environment
Hibernate version: 3.2.6
I need to create a criteria with an OR condition; i must use the Restrictions.or method.
Now Let's image i'ld love to have this kind of query:
Code:
select * from person where name='tom' or name='john' or name='linda';
I can image a so structured code:
Code:
Criteria crit = session.createCriteria(Person.class);
crit.add( Restrictions.or( Property.forName( "name" ).eq("tom"), Property.forName( "name" ).eq("john") ) );
//How can i add the third OR condition?
In the example how can i add the third or condition?
As you can see it's very simple to add an OR condition when i have a even number of condition; how can handle the scenario where the condition number is odd?
Regards,
Angelo