FAQ Database Discussion Community


Grails: Do addTo* and removeFrom* require a call to save?

grails,gorm,grails-2.0,grails-domain-class
In the docs some examples have a call to save whereas some others do not. I'm assuming that addTo* needs the call to save whereas removeFrom* doesn't. Am I mistaken?

Grails domain object not refreshing in gsp

grails,gsp,grails-domain-class
I have a domain User, that hasMany queues. Adding and displaying queues works ok, but when i delete a queue from a user, the queue is deleted, but is still displayed in the browser. The view is refreshed only when i logout and login again. Where i remove them: def...

Grails validation over own domain

hibernate,grails,grails-domain-class,grails-controller,grails-validation
I'm using Grails 2.4.2 and have a class Contract which has many InvoiceRecipient's. The InvoiceRecipients class has an attribute invoiceType which has 2 possible values, 'O' for the invoice-original and 'C' for an invoice-copy. As you could imagine, only one record with type 'O' is allowed for the InvoiceRecipients for...

Method on class [] was used outside of a Grails application controller

gorm,grails-domain-class,grails-2.3
I have below grails config: Datasource. environments { development { dataSource { dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', '' url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE" } datasource_staging_oracle { dbCreate = "none" url = "jdbc:oracle:thin:@//myoraclehost:1521/DBNAME" driverClassName = "oracle.jdbc.OracleDriver" username = "username" password = "password" } } Domain class: import org.springframework.integration.Message...

domain class constraint in entry creation

grails,constraints,grails-domain-class,grails-controller
In my Grails project I need to add a particular constraint to an entry of my domain class object. Domain class is as follows: class HealthServiceType { String healthService; static belongsTo = [doctor:Doctor] static constraints = { } static mapping = { } } I need that healthService is not...

MissingPropertyException in grails

grails,grails-domain-class,grails-controller,grails-services
I have a problem when I try to show the view of one of my domains. I built a method to sum some quantities, but I have this error and I don't know how to fix it. I understand that the variable awards does not exist, but I have this...

GORM: What is reference:true in Grails domain class mapping block?

grails,gorm,grails-domain-class
public class Address { static mapWith = "mongo" Region region; Zone zone; static mapping = { id generator: 'identity' region reference:true zone reference:true } } I'm interested in knowing what reference:true does. In my experience, leaving it off gives exactly the same result except there's no DBRef in the actual...

How to show parent domain field in select box in grails

grails,gorm,grails-2.0,grails-domain-class,grails-controller
I am using grails 2.1.0. I need to show a parent domain's field value through parent chain in select box in a gsp page. But I am getting error. So far I have tried as follows :: my first domain which contains parents as named adtAuditPack >>> class AdtAuditorSchdlPack {...

Set property method in grails could not change the instance globally

grails,grails-2.0,grails-domain-class
I have a domain class DbUserSchemaServer with a transient property unassign class DbUserSchemaServer { static transients = ["unassign"] DbUser user String schema DbServer server BigInteger objects Date creationDate String schemaStatus //for dropping Boolean protect //Transients Boolean unassign static constraints = { user unique:false, nullable: false, blank:false schema unique:'server', nullable: false,...

grails create a list with like query from parent and child domain

grails,gorm,grails-domain-class
I am using grails 2.4.2. I need to create a list based on like keyword of query. Suppose this is an example >> def results = c.list(max: iDisplayLength, offset: iDisplayStart) { and { // eq("activeStatus", ActiveStatus.ACTIVE) } if (sSearch) { or { ilike('title', sSearch) ilike('shortDesc', sSearch) } } } Here,...

Grails: What is the difference between extending and embedding a domain class?

grails,grails-domain-class
I'm very new to the Grails framework, so please bear with me. Nonetheless, I am a bit confused on the functionality difference between extending a domain class and embedding objects. From a database point of view, they both do the same thing. When embedding an object, all the properties of...

How to delete a child domain row in grails

oracle,grails,gorm,grails-2.0,grails-domain-class
I am saving data to my entry meeting table as well as entry meeting details table which is a child table of entry meeting table. But When I want to delete only a child table record it's giving a error. I can't understand what to do. I am using grails...

Update to grails domain don'tpersist

grails,gorm,grails-domain-class
I'm working in grails 2.3.8 We have the following domain classes: abstract class GroupItem { static belongsTo = [group:AppGroup] static mapping = { tablePerHierarchy = false } } class MyDomain extends GroupItem { String name String type int Identifier static hasMany = [attributes:Attribute] static mapping = { attributes cascade: 'all-delete-orphan'...