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

GORM (varchar .save(), non DATE): ORA-01861: literal does not match format string
GORM addTo methods not found in Spock test
spring-boot property exception while externalizing datasource properties and using actuator
Mapping hasMany relation and saving the related data
Method on class [] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails Correctly
What happens when two app servers in cluster start LiquiBase update (via Grails)?
use of mappedBy in Many to Many relationship in Grails
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

Categories

HOME
client
jdo
homebrew
tesseract
routes
sharepoint-designer
ojdbc
pivotal-cloud-foundry
opengl-es-2.0
networkx
constraint-programming
google-translate
communication
fancybox-3
timeout
jplayer
circular-dependency
static-libraries
fortumo
ghc
progressive-web-apps
fatal-error
transformation
footer
ab-testing
dbext
physics-engine
arabic
tapestry
telerik-reporting
tibco-mdm
crosstab
smb
buildbot
traffic
entitlements
publish
replaceall
vision
primitive
srcset
bluestacks
google-rich-snippets
uisplitview
airconsole
ioio
jspresso
framemaker
textmate
hilbert-curve
bootstrapper
texmaker
midl
termination
revapi
errordocument
jquery-validate
boost-multi-index
datastax-startup
sage-one
dotnetzip
diagnostics
qtwebview
mediaelement
fody
etsy
player
tform
freedesktop.org
sdhc
qdialog
wordml
embedded-code
appfabric-cache
mmc
census
proj4js
geonetwork
modalpopup
pick
phalanger
cctv
zend-route
tld
marmalade
resty-gwt
floating-point-precision
oam
blending
odata4j
plasma
sabredav
clipper
referrer
rdoc
netbeans-6.9
assembly-loading
hamachi
netbeans-7.1
calling-convention
html-input
xsdobjectgen
routedevent
boost-smart-ptr

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App