Disjunction and conjunction are logical or logical and can be used to construct complex SQL query conditions, as follows:
private void Checkbsc_lj (Criteria querycriteria)
{
Disjunction disjunction = restrictions.disjunction ();
Criterion cirterion = restrictions.sqlrestriction ("simulportcapacity<simulportcapacityocupied". ToLowerCase ());
Disjunction.add (cirterion);
Cirterion = Restrictions.sqlrestriction ("adslportcapacity<adslportcapacityoccupied". ToLowerCase ());
Disjunction.add (cirterion);
Cirterion = Restrictions.sqlrestriction ("lanportcapacity<lanportcapacityoccupied". ToLowerCase ());
Disjunction.add (cirterion);
ONU port, at least one port to be entered
conjunction conjunction = Restrictions.conjunction ();
Cirterion = Restrictions.eq ("lanportcapacity", 0);
Conjunction.add (cirterion);
Cirterion = Restrictions.eq ("simulportcapacity", 0);
Conjunction.add (cirterion);
Cirterion = Restrictions.eq ("adslportcapacity", 0);
Conjunction.add (cirterion);
Disjunction.add (conjunction);
Querycriteria.add (disjunction);
}
The
Constructs the following conditions:
SELECT *
from AAAA this_
where (simulportcapacity < simulportcapacityocupied or
adslportcapacity < adslportcapacityoccupied or
lanportcapacity < lanportcapacityoccupied or
this_. Lanportcapacity =? and This_. Simulportcapacity =? and
This_. adslportcapacity =?))