Questions tagged [grails-domain-class]

deals with issues related to the definitions of domain model

689 questions
4
votes
2 answers

Grails: Creating classes that you do not want to store on the DB

In grails is creating a new domain class and never persisting any objects to the db, the best way to create a class that you don't want to store in the db?
Orca Ninja
  • 823
  • 1
  • 15
  • 29
3
votes
2 answers

How to override the DomainClass.list() in GORM (Grails)

People, I'm facing a problem with grails GORM, my Application is totally dependent of the DomainClass.list() method, it is in all of my create/edit GSPs, but now I need a particular behavior for listing objects. Being more specific I need to filter…
JRafaelM
  • 861
  • 2
  • 10
  • 23
3
votes
1 answer

Domain class hasMany fails to add entry

I'm a Grails noob so please excuse my noob question. I've created a domain classes User and Device. User hasMany devices:Device, and Device belongsTo user:User. It is important that only 1 device will never belong to two users so my UserController…
Nadav
  • 1,167
  • 2
  • 19
  • 43
3
votes
5 answers

grails-CodeNarc and Service Stateless ruleSet

I am trying to use codeNarc on a grails project, after installing it and running it I've have some rulesets violations messages that I would like to understand and resolve. The first on concern "GrailsStatelessService" and the second the …
KAdjevi
  • 33
  • 6
3
votes
3 answers

how to implement soft deletes

Can anyone tell me what would be a good way to implement soft deletes? I can have a deleted property in my class, but my question is how to easily ignore instances which have deleted = true in my searches, listings and so on. So, rather than saying…
zoran119
  • 10,657
  • 12
  • 46
  • 88
3
votes
1 answer

Grails domain version value as part of JSON

In a edit page, I am passing the domain object as JSON object to be manipulated at client side using jQuery. render domainClassObject as JSON When I see the response in client side (in firebug for e.g.), there is no "version" property. Only…
Jay Chandran
  • 382
  • 1
  • 8
  • 20
3
votes
1 answer

Grails Domain Classes Primary Key

class Ctr_country { String ctr_name String ctr_abrev String toString(){ ctr_abrev } } I am using SQLS Express as database. I want the primary key of this class (table) to be ctr_abrev. a) How can i do so ?
John
  • 259
  • 8
  • 19
3
votes
2 answers

Page Refresh(F5) changes the data on the screen after successful save in db in Grails app

I have developed a grails/groovy application for a legacy database which has user maintenance page to (add,edit) user information. The page is using editinplace and ajax to update the information. The program has been tested on local with no…
Alidad
  • 5,463
  • 1
  • 24
  • 47
3
votes
1 answer

Grails GORM on multiple Forms

Usually I'm using One-to-many relationship by this way : class Study { static hasMany = [ crfs : Crf ] String name ... } class Crf { String title String info ... } I can extend this relationship to others domains, Ex : static…
Fabien Barbier
  • 1,514
  • 4
  • 28
  • 41
3
votes
3 answers

Grails custom validator for domain class

I have a restriction so there could be no more than ConfigurationHolder.config.support.reminder.web.person.max object stored. I didn't find how to add a validator which doesn't relate on particular property. So for now I implemented it in this way.…
Aleksey
  • 1,309
  • 2
  • 10
  • 12
3
votes
3 answers

How To Solve Grails Error Repeated column in mapping for entity? on Existing Postgresql Database

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 false id…
user544296
  • 31
  • 1
  • 3
3
votes
1 answer

grails won't save but have no error

Hi I have a domain that so simple like the following // page 52 Bankruptcy Questions class FamilyLawFinancial{ Date dateOfTheOrder ; boolean isPartyToFamilyLawProperty = false; boolean isCurrentlyInvolvedInFamilyLawProperty = false; …
nightingale2k1
  • 10,095
  • 15
  • 70
  • 96
3
votes
1 answer

java.lang.IllegalStateException: Could not find ApplicationContext, configure Grails correctly first

I have the following spock integration test for in grails 2.4.3, I have searched on google but didn't find anything understandable @Mock([Product,Price]) class ProductViewerSpec extends IntegrationSpec { ProductController productController = new…
3
votes
1 answer

Grails connect database fields

I'm trying to learn Grails but am still pretty much on beginner level. I made a tiny application, where you can basically add events, and people can write reviews about them and rate them. So I have an eventController and reviewController. The…
Silvie
  • 41
  • 1
  • 8
3
votes
4 answers

Grails - sort by the domain relation attribute (using createCriteria())

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 have the column "Action name", I would like…
Mateo
  • 193
  • 1
  • 2
  • 5