deals with issues related to the definitions of domain model
Questions tagged [grails-domain-class]
689 questions
0
votes
0 answers
Using domain classes as both persistent and transient?
I am implementing a trading system, and I want to use the same code for both live trading and backtesting. When doing live trading, I need to persist everything that happens, but when backtesting, I would like to use the same classes and logic but…

greymatter
- 840
- 1
- 10
- 25
0
votes
1 answer
Grails: How to limit the number of children in a one-to-many relationship
I want to restrict the number of children allowed in a one-to-many relationship between my Grails domain classes, preferably using constraints. The maxSize constraint seems to exist for this purpose (the Grails documentation confirms that it is…

Stephan B
- 837
- 1
- 16
- 41
0
votes
1 answer
Grails spring-security UserRole - Role fetch :'join'
I have typical auto-generated by spring-security classes. + I want to select Roles together with UserRoles (table join) in one query, therefore I have added fetch: 'join'.
class User {
def springSecurityService
String username
String…

user1969909
- 3
- 3
0
votes
1 answer
“grails.validation.ValidationErrors: 0 errors” while saving a domain class
I have the following domain class:
class StudentQuiz {
Date dateCreated
Date lastUpdated
Quiz quiz
float price
Student student
Date startTime
Date endTime
int score
List answers
static…

Sap
- 5,197
- 8
- 59
- 101
0
votes
2 answers
Grails - How to covert a query result (from MongoDB) to a JSON string without redundant fields
I have the following domain class
class Settings {
static constraints = {
pageID(nullable: false, unique: true)
lp()
}
String pageID
Map lp
}
I'm querying the DB like SO:
...
def query = Settings.where {pageID ==…

Shlomi Schwartz
- 8,693
- 29
- 109
- 186
0
votes
2 answers
Grails and mongo DB nesting data structure
I have a Grails project the interacts with mongo DB. I would like to know what is the best practice for creating domain classes that represent nesting data.
data for example:
settings:{
user:{id:1234 , name:"john"}
colors:{header:"red" ,…

Shlomi Schwartz
- 8,693
- 29
- 109
- 186
0
votes
1 answer
Domain design to store user's country, age group, etc
Here is the situation: a user table contains data that overlap with other users' data such as country, age group, gender, etc.
In MySQL, I would use three tables or two. In the case storing country, I would use three tables: one would the be user…

jjj
- 235
- 2
- 16
0
votes
1 answer
How to use the withCriteria results in a new withCriteria query in Grails?
Consider the first query:
def books = Book.withCriteria {
eq("category", "fiction")
}
How can I use the result of this query in the next query to get all the authors who wrote these books?
I tried:
def authors = Author.withCriteria {
…

Michael
- 32,527
- 49
- 210
- 370
0
votes
0 answers
iReports and grails. set javabeans data source and connection
I have some problems to configure iReports, I´m using iReport4.8.0 (I tried iReport4.7.1 before and the same problem happened) and grails ggts 3.0.0.
I have a domain class called Consulta in a package called consultas, I want to list them and create…

gcm
- 1
0
votes
0 answers
3,Mapping column named 'interface' in Grails seems impossible
It seems that it is impossible with Grails to map a domain class to a database table that has is a foreign key column named 'interface'.
In my case there's a relationship with two tables INTERFACE and INTERFACE_DETAILS. They are legacy databases…

knocker_d
- 506
- 6
- 16
0
votes
1 answer
Grails: Adding new field in Domain class causes crash
I have an older project running Grails 1.3.7, in the domain class (ex. Patients) I added a new field (boolean disabled, nullable is true).
class Hospital {
hasMany = [patients: Patient]
string name
class Patient
string name
string…

ibaralf
- 12,218
- 5
- 47
- 69
0
votes
1 answer
grails domain class save
I get the following error when I try to save a domain class, in grails:
No signature of method: java.lang.String.save() is applicable for argument types: () values: []
Possible solutions: size(), size(), take(int), wait(), any(), wait(long).…

jason
- 3,821
- 10
- 63
- 120
0
votes
2 answers
How to properly create a multiple one-to-one bidirectional relationship in Grails?
I am trying to create 2 domain classes User and MailBox
There will be 2 Mailbox for each User, one is sent, another is inbox.
I've tried multiple ways of solving this:
1 - (fails with a mapping exception)
Mailbox {
}
User {
static…

16dots
- 2,941
- 1
- 13
- 15
0
votes
1 answer
grails adding multiple children to parent domain
I am having some difficulties adding children domains to parents. here are the classes:
class parent{
String firstName
String lastName
String dobYear
String dobMonth
String dobDay
Date dateCreated
Date lastUpdated
long version
static hasMany =…

jason
- 3,821
- 10
- 63
- 120
0
votes
2 answers
Grails render template
I have this having this attributes,
Fill up the fields
…
David B
- 3,269
- 12
- 48
- 80