0

私のSQLは次のようになります。

select cell1 from table
where cell2 = 1
and (cell3 = '' or cell3 is null)

しかし、休止状態で「and(xまたはy)」の制限を行うにはどうすればよいでしょうか。

4

1 に答える 1

0

LogicalExpressionはどうですか

AND条件に対してこれを試してください:

Criteria cr = session.createCriteria(table.class);

// To get records matching with AND condistions
LogicalExpression andExp = Restrictions.and(cell2, cell3);
cr.add( andExp );

OR条件の場合、これを使用します

 // To get records matching with OR condistions
  LogicalExpression orExp = Restrictions.or(cell2, cell3);
  cr.add( orExp );

 List results = cr.list();
于 2013-03-25T09:34:33.220 に答える