deals with issues related to the definitions of domain model
Questions tagged [grails-domain-class]
689 questions
0
votes
2 answers
Display order for grails One to Many relationship
I have two domain classes as following
class Quiz {
String name
String description
int duration
User user
int points
static hasMany = [questions:Question]
}
and
class Question {
String question
String questionType
…

Sap
- 5,197
- 8
- 59
- 101
0
votes
1 answer
grails domain class design for many-to-many relationship
I am designing a grails app and many many-to-many relations have me stumped.
This is what I have so far...
Domain classes
Students
Tests
Questions
Here tests and questions will have m2m relationship. Which might be represented by a mapping class,…

Sap
- 5,197
- 8
- 59
- 101
0
votes
2 answers
For GORM Map type, add index to the table created by GORM
GORM has below example:
class Author {
Map books // map of ISBN:book names
}
When GORM create table, it will create a table with three column: author_books, author_books_idx and author_books_elt
The problem is none of this three column is…

Xilang
- 1,513
- 3
- 18
- 36
0
votes
1 answer
Grails or Hibernate not creating missing table
I'm new to Grails so forgive my ignorance--if other info is helpful I'll do my best to get it posted.
I've created a single domain model class ToolKitComponent that is defined as:
class ToolKitComponent {
String componentName
String…

OnResolve
- 4,016
- 3
- 28
- 50
0
votes
1 answer
Grails Multiple domain classes with belongsTo and default value
I have special case of domain classes structure where three classes presents and they are connected to chain: Event <- Room <- Projector. (All relation ships are one-to-one)
The implementation looks like:
class Event {
Room room
static…

kuceram
- 3,795
- 9
- 34
- 54
0
votes
2 answers
Set value in message.properties file from grails service
I want to set values to message.properties file.
I have already done it in java like the following:
Properties emailErrorMsgProp = new Properties();
emailErrorMsgProp.load(new FileInputStream("grails-app/i18n/messages.properties"));
…

Hardik Patel
- 937
- 3
- 14
- 39
0
votes
1 answer
Using findBy with same attribute but multiple values
I have a Product domain:
Product {
String name
}
Now I need issuedProductInstance and requestedProductInstance. For that I used findBy as
def find(String issuedProduct,String requestedProduct){
Product…
0
votes
1 answer
access a specific property of domain class in my controller
Hi I have a program where there are two domain classes. One that has different properties of my data objects (e.g. People) and another which is a User domain class which checks the login id and password to see if the user is authorized to make…

Ameya
- 549
- 1
- 10
- 19
0
votes
2 answers
While Generating controller and view getting error : Can not set int field lms.Book.bookId to java.lang.Class
While generating controller and view for a Domain class as:
class Book {
static constraints = {
bookId blank:false
bookTitle blank:false
}
private int bookId
private String bookTitle
private String author
…

AAA
- 348
- 1
- 4
- 19
0
votes
1 answer
Grails domain class id inheritance
I have four domain classes having common properties, transID, createdDate wherein the transID is typed int and mapped as the Primary Key of the table. By rule of abstraction, we seperate the common properties/attributes to an abstract class then let…

David B
- 3,269
- 12
- 48
- 80
0
votes
1 answer
Find if added in domain class - not using findBy
I have domain classes => many-to-many and associate them using addTo.
class Books {
static belongsTo = Author
}
class Author {
static belongsTo = Book
static hasMany = [books: Book]
}
Controller:
author.addToBooks(mybook).save()
=> I…

ibaralf
- 12,218
- 5
- 47
- 69
0
votes
0 answers
grails : how to get userList from Group
I have three class.
class User {
String userFirstName
String userLastName
}
class Group {
List userList
String groupName
static hasMany = [userList: User]
}
class work {
User worker
Group group …

sanghavi7
- 758
- 1
- 15
- 38
0
votes
1 answer
Grails: fields-1.2 plugin unable to read datamodel properties
DATAMODEL
package com.foo.bar.baz.model
class Customer {
Integer id
String firstName
String lastName
.....
}
GSP
....
....
The GSP is not in the…

klogd
- 1,118
- 11
- 19
0
votes
2 answers
How to map integers (on database) into strings (in views)
I have a domain class:
class MyUser {
..
int sex
int qualification
int occupation
..
}
Suppose I want to constraint these integer categories, for example:
occupation : [0:"not occupied", 1:"architect", 2:"student", 3:"policeman" and so on..]
I…

Giuseppe
- 41
- 4
0
votes
1 answer
Querying values from a Map Property in a Grails Domain Class
I found the solution Burt Beckwith offered in this question: add user define properties to a domain class and think this could be a viable option for us in some situations. In testing this, I have a domain with a Map property as described in the…

Rodney Seifert
- 13
- 3