gorm


GORM addTo methods not found in Spock test


I am using Gorm standalone with spring-boot.
I have a domain class, annotated with #Entity, which has several children collections.
#Entity
#EqualsAndHashCode(includes="id")
class Order {
String hash
static hasMany = [lines:OrderLine]
static mapping = {
hash column: 'hash', index: 'hash_index'
inputs lazy: false
}
}
Here is one of the child classes:
#Entity
#EqualsAndHashCode(includes="id")
class OrderLine {
int lineNo
double amount
static belongsTo = [transaction: Transaction]
static constraints = {
lineNo validator: {val -> val>=0}
amount validator: {val -> val>=0.0}
}
}
In a Spock test, after creating an Order, I cannot use the addToLines method. It complains that there is no signature of method addToLines.
If I manually set the lines collection to an ArrayList, I can then manually add a line, which is later persisted. If I don't manually initialize the lines collection, attempts to simply add fail.
So when in GORM do these collections get created and the addTo methods added to the class?
Dependencies in my gradle.build include:
"org.springframework.boot:spring-boot-starter",
"org.grails:gorm-hibernate4-spring-boot:1.0.0.RELEASE",

Related Links

Domain class auto validation in grails
Grails Detached Criteria Query and “group by” and “having” clause
Script for saving large no of entries in mongodb
Does the multiple datasource feature of Grails 2.0 support relations?
How to avoid ImprovedNamingStrategy in joinTable in Grails
Grails 2 Show transient property that is an alias for id column
How to save GORM class with composite id made from its own field?
Grails - 2 domains and 1 form create/update/edit issues
Is there a belongsTo mixed syntax for GORM many-to-many and back-reference
Why do these Gradle tests throw exceptions?
In grails 2 when using multiple datasources, can I specify which datasource a criteria should use?
GORM methods are not accessible in Domain and Service classes
How to initialize the domain class properties with the values of another Domain class properties in grails
Grails Domain Embedded
How to get count of all items in a criteria GORM query
'Requested bean is currently in creation' on a domain object

Categories

HOME
image
activiti
gremlin
iterator
bookshelf.js
google-docs
getelementsbytagname
yahoo-oauth
cmd
v8
acquia
google-apps-marketplace
orchardcms
hex-editors
fallback
quartz-scheduler
clojurescript
ef-migrations
apache-metamodel
connection-string
visual-composer
swiftlint
conemu
kryo
object-detection
tokenize
kudan
blazemeter
dxf
android-widget
smb
pepper
apache-commons-io
nat
titanium-mobile
mapdb
wixsharp
xcode-extension
lto
document.write
bootstrapper
optix
galen
ruby-on-rails-3.1
elmah
slick-3.0
babel-core
dds
prolog-setof
winscp-net
pebble-watch
veracode
csound
memory-alignment
webdriverjs
abcpdf9
angular-cache
underscore.js-templating
jwplayer7
disque
master-slave
apachebench
tform
phpcas
lib.web.mvc
spidermonkey
security-testing
xc16
java.util.concurrent
qcodo
id3v2
issuu
sgen
jquery-layout
expected-exception
datagridviewcolumn
ember-charts
meteor-velocity
qt-faststart
enterprisedb
http-unit
delphi-6
ticoredatasync
online-compilation
osql
blackberry-playbook
coercion
calling-convention
mysql-error-1005
commodore

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App