gorm


Grails Domain Embedded


I have this domain model, grails-app/domain, named com.portal.Schedule.groovy having this properties:
Subject subject
Room room
Day day
Time timeStart
Time timeEnd
static embedded = ['timeStart', 'timeEnd']
Where in the object com.portal.Time is located in the src/groovy having this properties:
Integer hour
Integer minute
public Time(Integer hour, Integer minute) {
super();
this.hour = hour;
this.minute = minute;
}
The problem is when I want to add a record using the BootStrap.groovy having this syntax:
new Schedule(subject: Subject.get(1), room: Room.get(1), day: Day.MON,
timeStart: new Time(9, 0), timeEnd: new Time(11, 00)).save(failOnError: true)
I get this error message prior to finish to start-up:
Message: No default constructor for entity: com.portal.Time; nested
exception is org.hibernate.InstantiationException: No default
constructor for entity: com.portal.Time
How can I resolve this to have my Bootstrap.groovy running with the instance of Schedule with those attributes?
Your Time constructor is set to private. That's why you're getting that error.
I've searched it thoroughly on Google how to solve this problem.
It's seems groovy has almost the same feature with python regarding constructor or in other terms tuples in Python located here
After inserting the annotation to the class Time I can now code the constructor in multiple ways.

Related Links

Can't use get() in domain using Grails3
GORM findAll + cannot pass dynamic List as named parameter
How to display database records in grails
Configure Grails 3.0.9 for Oracle 12c with identity PK?
Adding condition to findAll and findAllBy methods
Neo4j and Mongodb as datasource in Grails
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

Categories

HOME
ms-access
java
cloud
testng
activiti
stock
adb
infragistics
frameworks
ip
in-app-purchase
facebook-messenger-bot
imacros
php-7.1
ups
hapi
vaadin7
worldwind
interop
riot.js
intentfilter
graphicsmagick
tibco-mdm
jndi
smb
fluentvalidation
neo4j-spatial
replaceall
flink-streaming
preg-match-all
copying
language-concepts
bower-install
ios5
devextreme
main
abstract-class
service-discovery
unspecified
ssjs
jna
google-closure
fakeiteasy
bootstrap-dialog
node-sass
scorm
smartcontracts
parentheses
azure-application-gateway
theming
python-c-api
hendrix
winscp-net
aurelia-validation
diagnostics
jspdf-autotable
color-profile
webdriverjs
orthogonal
synchronous
spring-android
nxt
probability-density
ado.net-entity-data-model
dstu2-fhir
measures
xml-attribute
impresspages
contact-list
sigabrt
ubuntu-10.04
bgp
hexdump
tform
itextpdf
photobucket
historian
xna-4.0
quicklisp
arcanist
fluid-dynamics
sniffer
system32
web-controls
sorl-thumbnail
tablelayout
cctv
client-side-templating
preferences
internet-connection
cloud-connect
fmod
batterylevel
hamiltonian-cycle
jquery-knob
libstdc++
nsnetservice
bluepill
errai
parametric-equations
qtkit
gnustep
pydot
subgurim-maps
coercion
f#-powerpack
cinema-4d
self-extracting
calling-convention
html-input
visitor-statistic
h.323
zend-translate
gin
perfect-hash
compiler-specific
post-build
commodore

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