Questions tagged [createcriteria]

Creating criteria based queries with GORM, Hibernate or Grails

105 questions
1
vote
1 answer

how to trim a property in createCriteria

I am trying to trim a projection property but it does not let me do that. def c = Book.createCriteria() def books = c.list { projections { property ("title") } def now = new Date() between('publishingDate', now-45,…
rks
  • 451
  • 1
  • 8
  • 16
0
votes
3 answers

NHibernate query collection

I have a users and roles table. A user can have multiple roles. I want to grab all of the users without a specific role. The problem is if a user has 2 roles, one being the role we don't want, the user will still be returned. public IList
hayzie
  • 3
  • 1
  • 1
0
votes
1 answer

How to make where filter of createCriteria dynamic in Grails framework

I am doing search with Pagination in groovy For the sake of pagination in different pages, I put a count filter "where". I want to get colName here dynamically but for where filter we need to put a instance of the domain. Here, the domain is…
0
votes
1 answer

Convert SQL into Criteria statement

I want to convert this SQL query to Criteria statement, I'm using createCriteria(Entity.class) function. The following is the SQL query I want to convert: select sm.id, sm.mutation_type, u.id, u.display_name, advisor.id, advisor.display_name from…
0
votes
2 answers

GORM createCriteria with one-to-many relation

since a couple of hours I try to figure out how to create a criteria with a kind of must-be-in-list criterion. If I reduce my code I have following two domain classes: Hotel - The base domain class that I want to retrieve: class Hotel { static…
Christopher Will
  • 2,991
  • 3
  • 29
  • 46
0
votes
0 answers

I want to return from List and foreach of CreateCriteria in c# .net5

I want to exit when the result is true using ipnetwork. It exits from foreach, but it doesn't get out of the List and runs again. please tell me how to solve. Is there a way to do this without using ActionableList? Or is there a better way to…
류진현
  • 13
  • 3
0
votes
1 answer

Grails createCriteria parent with last child

How can I read only the lastChild along with parentObject Parent { hasMany[children: Child] } here is my code Parent.withCriteria() { eq("active", true) children { order("dateCreated", "desc") …
JiniKJohny
  • 1,172
  • 13
  • 29
0
votes
1 answer

How to implement dao to get list without createCriteria() and get list with following properties?

I am implementing DAO in Spring-5, Maven Project with Hibernate 5, for getting list with offset and maxcount with the help of sessionFactory.getCurrentSession().createCriteria() but its now deprecated and i want to implement I want these three…
0
votes
1 answer

Grails createCriteria syntax error

I am trying to create a list of companies which appear in either of 2 other lists. I can manage to create a list of companies appearing in 1 other list like this :- List masterList = Companies.createCriteria().list(){ …
Simon
  • 97
  • 3
  • 13
0
votes
1 answer

How do I perform Deep query in Grails using createCriteria

I have some grails Domain classes that have relationships between them like so... Domain A { ... Domain B } Domain B { ... Domain C } Domain C { ... String name String attr1 String attr2 } How can I use…
Pila
  • 5,460
  • 1
  • 19
  • 30
0
votes
1 answer

Grails minimum value fetch

I am working to fetch the minimum value from a table in Grails where the vehicleid and the type is given there are many values associated from that vehicleid and type i need to fetch the minimum date associated with that vehicleid . I have tried…
dhS
  • 3,739
  • 5
  • 26
  • 55
0
votes
2 answers

Sorting with Mathematical Formula with nHibernate (C#)

public class Feedback { public virtual int Id { get; private set; } public virtual string ContentText { get; set; } public virtual DateTime FeedbackDate { get; set; } public virtual Student student { get; set; } } My Feedback Class. public…
gandil
  • 5,398
  • 5
  • 24
  • 46
0
votes
0 answers

Grails createCriteria how to use two inLists()

I have a domain class People, which has multiple cars and houses: def People { SortedSet cars = new TreeSet() SortedSet houses = new TreeSet() } def Car { Long id } def House { Long id } In grails, I would…
Jay
  • 161
  • 1
  • 18
0
votes
1 answer

HQL query takes to long to execute

I'm knew to hibernate. I have a sql statement SELECT VERSION_ID,D_BEGIN,D_END, (SELECT NAME FROM zvit where ZVIT_ID=version.ZVIT_ID) as name FROM version where VERSION_ID in (SELECT term.VERSION_ID FROM term where term.PERIOD_MONTH=…
Evgen
  • 1,278
  • 3
  • 13
  • 25
0
votes
1 answer

How to compare collection item using createCriteria?

Registration domain has a collection of discounts. static hasMany = [ discounts: Discount] I want to extract all Registrations that have a particular discount applied. In the following code i want to get all registrations whose collection has the…
kofhearts
  • 3,607
  • 8
  • 46
  • 79