Persist a list of LocalDate with GORM


I'm trying to persist a list of joda LocalDate in grails. What I have right now is something like this:

package com.publidirecta import org.joda.time.LocalDate class Evento { List <LocalDate> fechas = [] static hasMany = [fechas:LocalDate] }

and I get the following error :

MappingException: Missing type or column for column[fechas_persistent_local_date] on domain[Evento] referencing[org.jadira.usertype.dateandtime.joda.PersistentLocalDate] ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 166 | run in java.util.concurrent.FutureTask | 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor | 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Thread

I tried with out the hasMany property, but doesnt work either(just didnt add anything)


As Alidad suggested you should wrap the LocalDate with a new entity and have a on-to-many relationship with this entity. In addition you will have to take care of mapping the LocalDate type to the database since this is not a type natively supported by Hibernate. Take a look at this <a href="http://gpc.github.com/grails-joda-time/guide/persistence.html" rel="nofollow">guide</a> which covers the topic.

Using the <a href="http://usertype.sourceforge.net/usertype.jodatime/index.html" rel="nofollow">User Type</a> library your class should look something like:

package com.publidirecta class Evento { static hasMany = [fechas: Fecha] List <Fecha> fechas = [] }


import org.jadira.usertype.dateandtime.joda.PersistentLocalDate import org.joda.time.LocalDate class Fecha { LocalDate date static mapping = { date type: PersistentLocalDate } }

Make sure your add the following to your BuildConfig:

dependencies { compile 'org.jadira.usertype:usertype.jodatime:1.9' }


How about defining your 'fechas' as another domain with localDate and create hasmany relationship:

something like this:


class Evento { static hasMany = [fechas: Fecha] }


import org.joda.time.LocalDate class Fecha { LocalDate date }


  • Nested ViewModel Classes in asp.net MVC
  • An error occured while executing doInBackground(). FATAL EXCEPTION:AsyncTask #10 [duplicate]
  • Groovy Grails Tool Suite NoClassDefFoundError on WAR deployment
  • @Autowiring not working at Field Level
  • Current date without time
  • NHibernate: Default value for a property over a null column
  • php session expires randomly after a few minutes
  • Spring MVC 3.1 exception : An Errors/BindingResult argument is expected to be immediately after the
  • Server control behaving oddly
  • How to have NHibernate persist a String.Empty property value as NULL
  • Hibernate Joda DateTime Sorting
  • java.lang.IndexOutOfBoundsException occuring on ArrayList
  • Invalid Date on validation Date of js
  • saving file generated by TCPDF
  • How to view images from protected folder with php?
  • Button click event not firing in jQuery
  • rspec simple example getting error on request variable in integration test
  • How to handle images sent by a mobile device?
  • Groovy: Unexpected token “:”
  • d3 v4 drag and drop with TypeScript
  • JSON response opens as a file, but I can't access it with JavaScript
  • Play WS (2.2.1): post/put large request
  • Replace value with Factor in r data.table
  • How to access EntityManager inside Entity class in EJB3
  • DomPDF {PAGE_NUM} not on first page
  • Lost migrations and Azure database is now out of sync
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Deselecting radio buttons while keeping the View Model in synch
  • Getting last autonumber in access
  • JavaScriptCore crash on iOS9
  • Importing jscolor library in angular 2
  • QuartzCore.framework for Mono Develop
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Arrays break string types in Julia
  • How to format a variable of double type
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How do I configure my settings file to work with unit tests?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Binding checkboxes to object values in AngularJs