Hi i want to write a query using criteria : The following query has to be created using criteria:
"Select Distinct(s2Taxper) from S2 where s2Tc='601' AND s2Txcd!=''"
thanks in advance
To put it simple, Hibernate Projections are used in order to query only a subset of the attributes of an entity or group of entities you're querying with Criteria. You can also use Projections to specify distinct clauses and aggregate functions like max , sum and so on.
Criteria criteria =
session.createCriteria(S2.class)
.add(Restrictions.eq("s2Tc","601"))
.add(Restrictions.ne("s2Txcd",""))
.setProjection(Projections.distinct(Projections.property("s2Taxper")));
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