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

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
GORM 1:N Association Cascades Delete Without belongsTo!
GNUstep - Can GORM open Interface Builder-created NIB files or not?

Categories

HOME
testng
path-finding
view
fme
mean-stack
filtering
amazon-ecs
survey
ip
ojdbc
flyway4
gorm
imacros
collectd
zend-framework3
msp430
fatal-error
facebook-page
footer
django-cms
introduction
dbext
grails3
ml
csrf-protection
excel-2007
chromium-embedded
claims-based-identity
blazemeter
one-to-many
vlsi
spark-jobserver
apache-commons-io
url-scheme
bootstrap-duallistbox
google-sites-2016
catel
caret
stringtemplate
phpfreechat
azure-sql-database
android-kernel
y86
vxworks
serve
swisscomdev
gesture
broadcastreceiver
preconditions
optix
fedex
ncalc
google-closure
arena-simulation
netcdf4
logfiles
scrollable
clean-architecture
celery-task
winscp-net
togetherjs
nsarray
home-directory
mikroc
thrust
testng-dataprovider
bgp
cyclomatic-complexity
feedback
splash
ios9.1
web-controls
p2
device-orientation
c3
knuth
reactfx
htmlcleaner
valuechangelistener
poller
undefined-reference
android-2.2-froyo
commoncrypto
cdc
jmapviewer
odata4j
bulkloader
ocunit
nsnetservice
first-responder
buildr
deobfuscation
file-comparison
celltable
locate
w3wp.exe
icanhaz.js
preference
perfect-hash
fixed-width
user-friendly
substrings
javap
3gp

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