Creating criteria based queries with GORM, Hibernate or Grails
Questions tagged [createcriteria]
105 questions
0
votes
1 answer
grails use order on createcriteria
I try to use CreateCriteria to fetch some ids. Since ListDistinct not support pagination,
I found a solution in the web to resolve this issue.
http://ondrej-kvasnovsky.blogspot.fr/2012/01/grails-listdistinct-and-pagination.html
But I when I tried…

Jils
- 783
- 5
- 12
- 32
0
votes
1 answer
CreateCriteria sorting on aggregate function sum
SELECT
[ProductErpIdentifier],
[PriceValue],
[ManufacturerProductIdentifier],
SUM([QuantityOrdered]) as [QuantityOrdered]
FROM
[eCommerceDev].[dbo].[OrderItem]
GROUP BY
…

stefan
- 11
- 3
0
votes
0 answers
Grails left outer join between unrelated domains.(one way one to many relationship)
I am following this link to bring some positive changes regarding performance in my app.
I have following two classes
class Topic {
String title
String body
String type
User user
static mapping = {
body type:"text"
…

Sap
- 5,197
- 8
- 59
- 101
0
votes
1 answer
Is there a 'contains' functionality on a collection of ObjectId property of a domain object for withCriteria?
I have a Subscription domain object which has a List of ObjectId as one of its properties, say 'subscribed'. I'm on Grails 2.1.2 and MongoDB.
class Subscription {
ObjectId id
List subscribers = [] as List
static…

Nader Ghanbari
- 4,120
- 1
- 23
- 26
0
votes
2 answers
Grails MissingMethodException: createCriteria in WAR, Runs Locally
I have a Grails app that is pretty vanilla. Domain objects over controllers. Everything runs fine when using locally using run-app or run-war. When I create the WAR file using grails war and deploy to Tomcat 7.0.25 webapps directory, I get the…

john_solo
- 25
- 1
- 8
0
votes
3 answers
grails list and createCriteria()
I have a list function for a grails web app. This list will populate a table base on some search criteria. Im using hibernate createCriteria to try to achieve this.
In this case they can search by 2 different key features. The username and the…

CoffeePeddlerIntern
- 659
- 3
- 13
- 29
0
votes
1 answer
Can I do a math operation inside a createCriteria
Is it posible to do a math problem inside a createCriteria?
For example:
If in my table I have two columns, if the two together make 100 I don't want to show it in my result of the query
or
if the other column is in other table?
table
column 1 …

user1698253
- 55
- 1
- 7
0
votes
3 answers
GRAILS: createCriteria NAND
I have a bunch of rows from my query in createCriteria, but some changes have to be made, I need to hide the rows with a 0 in a column and a letter A in other column, but i won't hide them if they have 0 and another letter , how can I make this in…

user1698253
- 55
- 1
- 7
0
votes
2 answers
Hibernate createCriteria list() return identical objects
can you help me with the code below. I'm querying Hibernate and the number of objects in the list
returned corresponds to the number of rows in my table. But it seems that every object in the list is identical. Indeed the following line prints the…

Gyonder
- 3,674
- 7
- 32
- 49
0
votes
2 answers
NHibernate CreateCriteria with Restrictions does not work as expected
The bellow given code sample is to retrieve all the active records.
session.CreateCriteria()
.CreateAlias("BasicInfo", "bsInfo")
.CreateAlias("DimentionInfo", "diInfo")
…

Desmond
- 1,308
- 1
- 19
- 27
0
votes
2 answers
using createCriteria with order based on a belongsTo property
I have the next scheme:
class UserProfile {
String title
String firstName
String lastName
static belongsTo = [user:User]
static constraints = {
user nullable:true , unique:true
title nullable:true,…

Isaid Htrs
- 13
- 2
0
votes
1 answer
compare two objects from same domain createCriteria Grails
Hi I have the following HQL query which I am running using executeQuery():
def q = Domain.executeQuery("Select d0 from Domain d0 where d0.id = (select min(d1.id) from Domain d1 where d1.code = d0.code and d1.service = d0.service and d1.site =…

Ameya
- 549
- 1
- 10
- 19
0
votes
1 answer
Grails: createCriteria wrong Results
I'm trying to get some data out of my Database by some criteria, but
i won't geht the right results.
My Method:
public ArrayList getAllBudgetsByUserAndDateAndActive(ArrayList dates, uid){
ArrayList BudgetList = new ArrayList()
Date lastDate…

Pasquale Brunelli
- 21
- 3
-1
votes
3 answers
How to convert and compare a date string post value with a createcritera filed date in grails?
I use Grails 2.0.3
and am comparing a a date string post value using creatCriteria and i have used below methods to convert the string into date but it always empty ? when i try , i can use params.date() method since i pass only one string ,for…

Develop4Life
- 7,581
- 8
- 58
- 76
-2
votes
1 answer
Grails createCriteria not returning any results
I'm trying to use the createCriteria in a grails application to return some rows from a DB. I'm not getting any results.
def query = {
ilike('fullName','%${params.term}%')
projections {
property('id')
property('fullName')
…