Questions tagged [detachedcriteria]

189 questions
1
vote
1 answer

Grails: Detached Criteria for multiple nested relationships

I am trying to sort my data by a layer 3 relationship but I can't see to get it to work. I have successfully use aliases to query for level 2 relationships. This is how I have my query setup def query = Application.where…
Raymond Holguin
  • 1,050
  • 2
  • 12
  • 35
1
vote
0 answers

More than one "one to many" association using Detached Criteria (XML Based Hibernate Configuration)

I am trying to join three tables by using Detached Criteria Class of Hibernate. I have three tables those are STUDENT,STUDENT_CORRESPOND,STUDENT_COURSES Primary Keys of tables are **Table Names** **Primary Keys** STUDENT …
1
vote
1 answer

What is IDetachedQuery and its difference with DetachedCriteria?

What is IDetachedQuery and its difference with DetachedCriteria? How and when IDetachedQuery is used? UPDATE: I'm using NHibernate 2.1.2.4000
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126
1
vote
1 answer

Java Hibernate: Passing current row id to Subquery

I have two Objects Post { long id String post Date lastUpdate } Tracker { User user Post post Date viewed } User and Post are the composite ids for Tracker While querying Post I want to figure out if the User has read the…
MandarK
  • 143
  • 1
  • 8
1
vote
1 answer

Hibernate Criteria Subquery HibernateException: Unknown entity: null

The scope is to get all the Bid elements which have been created by userId and are part of the Project projectId AND for which there exist a Decision, on that Bid for which the Verb.verb String is "accepted". However, I am getting…
Jose Ospina
  • 2,097
  • 3
  • 26
  • 40
1
vote
1 answer

JPA 2 Remote Criteria?

Is there any way that criteria for queries can be built on a remote (Swing/SWT etc) client? We've been using the DetachedCriteria functionality in Hibernate for quite some time, but would like to use standard JPA 2. If not, could the code from…
Kango_V
  • 1,720
  • 2
  • 15
  • 11
1
vote
2 answers

convert criteria to detached criteria for self join

I would like to know if i can convert this criteria into a detached criteria. I am not understanding detached criteria correctly. can some one help. Criteria crit = sessionC.createCriteria(OP_DOCTOR_VISIT.class,…
Sanal S
  • 1,105
  • 14
  • 27
1
vote
0 answers

Hibernate INNER JOIN GROUP BY for Multiple class

I am new to Hibernate, I want to convert the following query to Hibernate coding. SELECT a.RegisterCount, b.Id, b.Type, COUNT(a.RegisterCount) AS Expr1 FROM Student AS a INNER JOIN Search_OldStudent AS b ON a.StudentId = b.Id GROUP BY…
Sampathkumar
  • 121
  • 1
  • 11
1
vote
0 answers

Hibernate how to use detachedCriteria with Query Cached

I have a detachedCriteria like this private final DetachedCriteria DETACHED_CRITERIA_FOR_FILTERING_STUDENTS= DetachedCriteria.forClass(Students.class) .add(filters) .add(super.criterionForFilteringStudents) …
chiperortiz
  • 4,751
  • 9
  • 45
  • 79
1
vote
1 answer

What is the preferred way of using unsupported SQL functions or clauses with Castle/NHibernate?

I modeled all of my tables and already ported most of my queries using detached criteria's. All is working very well however I'm at a point where I don't know how to advance. I have a sub-query that uses Oracle's "connect by" clause. How do…
Mike
  • 4,257
  • 3
  • 33
  • 47
1
vote
0 answers

Criteria query whith FROM clause which contains only one query and does not contain any tables

I have the following query and I don't know how can I write it using criteria. SELECT questions_cnt, COUNT(*) users_cnt FROM ( SELECT COUNT(DISTINCT question) questions_cnt FROM UserAnswer GROUP BY user ) t GROUP BY questions_cnt I…
J2James
  • 23
  • 4
1
vote
1 answer

Hibernate subquery apply DetachedCriteria to ManyToMany join table

I'm trying to create a subquery that will take a DetachedCriteria that selects from the join table where there are entries for an entity; essentially I want to see if an entity has any associations via the join table. Depending on a passed boolean…
Autonomy
  • 402
  • 4
  • 13
1
vote
2 answers

could not resolve property

I have join two table .i want retrieve data by adding some detached criteria but it show "could not resolve property" error. "userMaster" table: @Entity @Table(name="user_master") public class UserMasterTbl implements Serializable { private…
Dipesh More
  • 109
  • 1
  • 14
1
vote
2 answers

Search for a property in Hibernate after aplying a function

In my db I store telephone numbers of things as input by the user (I want to let user decide how he format their phone number) when users search for a phone number they most likely wont format the number in a way that I can just compare the two…
JorgeO
  • 2,210
  • 5
  • 20
  • 22
1
vote
2 answers

Grails Convert SQL into Grails criteria query

I have following domain structure :- class A{ B b C c String email } class B{} class C { D d } class D{} Below is my SQL query which I needed to convert into Grails Criteria Query. select * from A aa inner join C ca on ca.c_id =…
Sumit Verma
  • 91
  • 1
  • 7