This is the query that I am trying to write in Criteria:
SELECT * FROM abc
WHERE NOT PartType IN ('0','4','5','6','7','a','b','c')
The above is in iBatis.
So this is the hbm.xml for the table
<class name="Parts" table="SomeDb..Parts">
<id name="recordNumber" column="Recnum" />
<property name="partNumber" column="Partnum" />
<property name="sectionNumber" column="Secnum" />
<property name="articleNumber" column="Articlenum"/>
<property name="headerNumber" column="Headernum"/>
<property name="partType" column="PartType"/>
<property name="code" column="Code"/>
</class>
The partType is nvarchar with the length of 1 in a SQL Server db. I am trying to select records that do not have a part type of any of this '0','4','5','6','7','a','b','c'. Hope I have answered your question. Thanks
Restrictions with CriteriaCriteria cr = session. createCriteria(Employee. class); Criterion salary = Restrictions.gt("salary", 2000); Criterion name = Restrictions. ilike("firstNname","zara%"); // To get records matching with OR conditions LogicalExpression orExp = Restrictions.or(salary, name); cr.
uniqueResult() Convenience method to return a single instance that matches the query, or null if the query returns no results. Method Detail.
Double-click the Last Name and City fields to add them to the query design grid. In the City field, add the “Like B*” criteria, and click Run.
Criteria criteria = ...;
criteria.add(
Restrictions.not(
Restrictions.in("partType", new String[] {"0","4","5","6","7","a","b","c"})
)
);
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With