grails-domain-class Questions

3

Solved

I am looking for a way to validate IP addresses in Grails via constraints. Is something like this possible? package example class Ip { String ip static constraints = { ip(unique: true, inet...

3

Hi i have this following Domain in Grails class Customer { static mapping = { table 'customer' // version is set to false, because this isn't available by default for legacy databases version...
Sartre asked 16/12, 2010 at 5:31

3

I have a domain as follow: class Author { String id static hasMany = [accounts: Account] static belongsTo = Account static mapping = { accounts joinTable: [name: "SOMETABLE", key: 'SOMEFIELD'...
Transubstantiation asked 4/10, 2013 at 17:42

2

Solved

I am in the process of upgrading to grails 2.1.x, and need to redo some of my old-style tests. I just added a new test to my spock Spec, and for this test I need to mock an additional Domain class...
Broadcaster asked 8/4, 2013 at 8:5

4

Solved

I've got an application that was using Grails 1.3.7 which I've just migrated to Grails 2.0. The application makes use of the automatic dateCreated and lastUpdated fields to manage the timestamps as...
Lisbethlisbon asked 29/1, 2012 at 9:52

4

Solved

I have two domain classes one is parent and other one is child and i have a hasMany relationship between them. Parent class has many childs and child class belongs to parent class. And here is codi...
Renaerenaissance asked 2/10, 2013 at 18:35

3

Solved

I have an issue where my domain class has two potential mutually exclusive external keys, either a serial number or a legacy lookup value. Since I'm not sure which one I'll have for any given entr...
Orthodontist asked 14/7, 2012 at 4:20

3

Solved

How do I set up a variable within a domain class that is not persistent. I want to be able to write and read to that variable, but I don't want it to be a part of the table. The way to do this in ...
Bechler asked 16/12, 2011 at 15:35

1

According to the docs, Grails provides a number of constraints that "have no impact on persistence but customize the scaffolding". One of them is the passwordconstraint. Here's how I use it: class...
Dunning asked 22/11, 2016 at 14:2

3

Solved

I'm trying to set a default value for a Date field in a Domain class. I can use defaultValue in the mapping configuration but it doesn't work with Date fields (I've tried it on String and Integer ...
Ollayos asked 25/11, 2013 at 20:31

3

I have this simple domain class: class Settings { static constraints = { uid(nullable: false, unique: true) person() } String uid Map person } and a web UI that update the data using a json r...
Calumet asked 25/2, 2013 at 12:49

3

When I save an instance as: test.save() the save could fail. I could do if (!test.save(flush:true) { // save failed } Consider that case that I got an instance from another function and co...
Vigilantism asked 28/7, 2014 at 13:23

4

I have two domain classes with 1:n relationship: import Action class Task { Action actionParent String taskName } and class Action { String actionName } I have the list of Tasks where I ...
Shatzer asked 1/8, 2010 at 18:34

3

Solved

PROBLEM I know there is already a question in regards to this but I think that the issue that causes might be different based on what they are saying. I have the following setup: grails version:...
Conradconrade asked 26/12, 2013 at 14:38

1

I am using Grails-ElasticSearch Plugin(0.0.2.5). I want to add a constraint to my domain instances before it is indexed in ElasticSearch. Example:- I have a domain class A with a field 'status',...
Garrettgarrick asked 12/6, 2014 at 5:28

1

I have two domain classes Question and Tag. Question has 'hasMany relation' with Tag. I am trying to save a question with some tags, but the error message is "Failed to convert property value of ...

3

Solved

Is there a good/standard way to execute some common code before every save() invocation on domain classes? For example, my domain class Page { String url Boolean processed Date date Integer...
Kimmel asked 3/6, 2012 at 20:24

4

I want to use the database-migration grails plugin for database migration. When I start my Grails app the first time all the database tables are created automatically. The production setting in my ...
Arriaga asked 21/12, 2012 at 10:39

4

Solved

How do I get to the Config.groovy information from a domain object, or from a static scope? I'm using ConfigurationHolder.config.* now, but that and ApplicationHolder are deprecated so I'd like to ...
Conclusive asked 8/8, 2011 at 1:23

5

Solved

I'm facing a issue regarding inheritance in Grails. I have a domain class Person.grooy: class Person{ String name String contactNumber Address address } Now I'm extending Person.groovy for E...
Heritor asked 30/12, 2013 at 12:22

4

Solved

I am a complete noob when it comes to grails (and still very noobish when it comes to groovy) so I apologise if this is a dumb question. I am building a simple web app and I want to control portio...
Cubby asked 16/8, 2010 at 1:52

1

I suddenly started facing a strange issue while working on my Grails application using IntelliJ. I have different domain classes and some other classes under src/groovy. When I open a class file to...
Selfsacrifice asked 19/6, 2014 at 8:8

3

Solved

I am new to Grails. Can I use "hasOne" or "hasMany" without using "belongsTo" to another domain-class? Thanks in advance.

2

Solved

I have several Grails 2.1 domain classes that include dateCreated and lastUpdated fields that GORM manages automatically, eg: class Person { Date dateCreated Date lastUpdated String name } I ...
Josh asked 22/11, 2012 at 15:53

2

Solved

I have two domains class DomainA { String name Date dateCreated Date lastUpdated static transients = ['email'] static hasMany = [domainBs: DomainB] public String getEmail() { DomainB.mos...
Taiga asked 24/4, 2014 at 7:31

© 2022 - 2024 — McMap. All rights reserved.