Questions tagged [dynamic-finders]
49 questions
0
votes
1 answer
Rails dynamic finders for many to many relationships
I have a model, "recipe". Here's the model;
https://github.com/mikeyhogarth/Nomelette/blob/master/app/models/recipe.rb
I am able to use dynamic finders to write code like this;
Recipe.find_all_by_name "spaghetti bolognaise"
but the following gives…

Mikey Hogarth
- 4,672
- 7
- 28
- 44
0
votes
1 answer
Undefined save method when using dynamic finders in rake task
I have a simple rake task importing records from a CSV file and saving them into the database.
require 'csv'
namespace :import do
task :items => :environment do
CSV.foreach(Rails.root.to_s + '/public/data/items.csv', :headers => true) do…

Jamie Buchanan
- 3,868
- 4
- 22
- 24
0
votes
2 answers
GORM: ilke and inList combination
In Grails, with DynamicFinder how can we execute a query using ilike along with inList? Or can we use CriteriaBuilder to combine ilike and inList? Thank you!

Đinh Hồng Châu
- 5,300
- 15
- 53
- 90
0
votes
1 answer
Grails Many-To-Many - Problems of dynamic finder
I hope you can help me guys. Google unfortunately didn't helps me out and my search here at stackoverflow didn't as well :-(
I have two DomainClasses HumanResource and Task with a many-to-many relationship.
Model-Definitions:
Task:
class Tasks {
…

grailsInvas0r
- 655
- 2
- 10
- 25
0
votes
1 answer
How can I make a dynamic Grails search?
Consider this domain class:
class House {
Integer room
Integer bathroom
Date builtDate
Date boughtDate
String roadName
String getSearch(){
return room + " " + bathroom + " " + builtDate + " " + boughtDate
}
}
I imagine having…

John22_2
- 123
- 1
- 1
- 7
0
votes
1 answer
Is there a way to ignore a hasMany relationship when using dynamic finders?
class Author {
static hasMany = [books: Book]
String name
}
class Book {
static hasMany = [chapters: Chapter]
String title
}
class Chapter {
String chapter
}
If I am trying to find all authors Author.findAll() , is there a…

paxtuik
- 47
- 1
- 13
0
votes
1 answer
GORM for Hibernate outside of Grails
Starting with a github repo that demonstrates how to use GORM outside of Grails, I am attempting to use dynamic finders so that I can look up a particular domain object by one of its properties. In this example, we have this person object in groovy…

Scott
- 458
- 4
- 10
0
votes
2 answers
Best practice - Getting a domain object in grails by a static field?
So we have unique 'codes' for some of our grails objects (ref data), and when we want to retrieve them, we do so by calling them with their static code:
Currency.findByCode(Currency.DOLLAR)
Perhaps I'm completely wrong, but this seems like a very…

Igor
- 33,276
- 14
- 79
- 112
0
votes
1 answer
How to implement NamedQuery based finder in Spring Roo?
I can't find information about how to use standard JPQL based queries with Spring Roo project. I'm not sure if dynamic finders will be sufficient for complex queries. Is there any way to use @NamedQueries in Spring Roo project without breaking the…

jmiedzinski
- 1
- 2
0
votes
2 answers
dynamic attribute based finders in active record 3.2.10
Am a security enthusiast and a total noob to RoR. Now there is this blog i came across regarding SQL Injections in RoR with Active Records in place.
SQLi in RoR Active Records
However the blog itself dates back to Jan 2013. Nevertheless, I tried to…

qre0ct
- 5,680
- 10
- 50
- 86
0
votes
2 answers
Rails find_by macros with a has_many relationship
I'm having trouble with the Dynamic attribute-based finders in rails. They don't seem to exits for my model.
class Person < ActiveRecord::Base
belongs_to :team
end
class Team < ActiveRecord::Base
has_many :people
end
So in script/console, to…

SooDesuNe
- 9,880
- 10
- 57
- 91
0
votes
1 answer
Does Play Framework use "Dynamic Finders"
I worked on Spring Data JPA, it is amazing library, but you should write your Database finders as a method signature before you can use.
When I looked at Grails, I find the concept of I do not have to write method signature to use the finder, it has…

Muhammad Hewedy
- 29,102
- 44
- 127
- 219
0
votes
1 answer
Grails design pattern for parallel queries using dynamic finders
Problem:
We're querying our database with a lot of entries. The overall application performance is okay. But I think it could be better if our bottleneck, querying a special table, could be done parallel.
We are using for that dynamic finders…

Mirko
- 1,512
- 1
- 12
- 19
0
votes
1 answer
Create dynamic finder between two classes in Grails
I have two domain classes (db tables) in my Grails project:
class Doctor {
String role;
String name;
String surname;
String address;
...
@NotNull
static belongsTo = [secUser:SecUser]
....
}
class SecUser {
transient…

FrancescoDS
- 1,077
- 4
- 21
- 55
0
votes
2 answers
Grails findById( null ) returning "random" result
I found a very strange behavior in our grails application today that i want to share with you.
We are using grails 2.3.11 on mysql 5.1.48.
We had a DomainObject.findById( id ) in one of your Controller actions.
We failed to check the id for a null…

Oliver
- 117
- 1
- 5