Questions tagged [detachedcriteria]

189 questions
0
votes
0 answers

how to use subquery with projection using criteria in hibernate

I have written a query in sql which is like... SELECT c.clientfirstname, c.clientlastname, c.clientage, c.status, Sum(i.annualamount) AS amount, p.planname, c.clientid FROM client c, income…
0
votes
2 answers

How should we query multiple one-to-many relations

Domain I'm trying to optimize my queries and need some advise. Is this the preferred way of querying one-to-many relations? My domains looks like this: MeasureSet /// /// /// /// /// Tables: none …
Rob Angelier
  • 2,335
  • 16
  • 29
0
votes
1 answer

Hibernate Query To Search Content in a Forum Questions

I want to search the contents in a forum especially forum questions for example: searchString = "Hibernate Session Configuration"; will give corresponding details in the Forum Questions but all the words need not to be consecutive in the forum…
schoolcoder
  • 1,546
  • 3
  • 15
  • 31
0
votes
1 answer

Criteria with multiple table Eager join

Code DetachedCriteria criteria2 = DetachedCriteria.forClass(MasterResult.class); criteria2.createAlias("masterCCHolders", "masterCCHolders", CriteriaSpecification.INNER_JOIN); criteria2.createAlias("masterFlights",…
Vinit Prajapati
  • 1,593
  • 1
  • 17
  • 29
0
votes
1 answer

SetFirstResult(0) works but not SetFirstResult(1)

I'm trying to do pagination on my webapp with MVC3 and nhibernate, the first page works fine but nothing else than SetFirstResult(0) works! .SetFirstResult(request.pageIndex *…
John Doe
  • 49
  • 4
0
votes
1 answer

DetachedCriteria - How to convert detached criteria result to integer?

Please help me with this. Im using detached criteria to get the total number of customers. In my CustomerDaoImpl: @Override public int getCustomerSize() { DetachedCriteria dc = getDetachedCriteria(); …
NinjaBoy
  • 3,715
  • 18
  • 54
  • 69
0
votes
1 answer

Hibernate Restcrition Criteria OR with DetachedCritera

I am trying to create a detached criteria that has an OR restriction DetachedCriteria subquery = DetachedCriteria.forClass(Component.class); subquery.createCriteria("review").add(Restrictions.eq("owner", user)); …
Boris Horvat
  • 563
  • 2
  • 13
  • 28
0
votes
1 answer

How do I serialize an NHibernate DetachedCriteria object?

I am looking for a solution to persist NHibernate DetachedCriteria objects to a database. I have tracked down the NHibernateUtil and the GetSerializable method, but I'm unsure how to use it to serialize a DetachedCriteria object. Any help on this…
Aaron Palmer
  • 8,912
  • 9
  • 48
  • 77
-1
votes
1 answer

Distinct query in Criteria NHibernate

I need the corresponding query in Criteria language to this one (to retrieve all categories from my table but to distinct them): SELECT DISTINCT categoryName FROM Category WHERE CategoryID IN ( SELECT CategoryID …
1 2 3
12
13