Domain List fields in Grails 2.4.4

632 views Asked by At

I'm upgrading a 2.3 app to 2.4.4 and I have several domains that use List fields similar to the following and I'm receiving an error as described here.

class Game {
  List score

  static hasMany = [ score: Integer ]
}

I'm assuming use of the above is the actual cause of the problem but I can't be sure because the error message doesn't point to a domain.

Is this type of list definition not good grails practice?

I get the error:

2014-10-31 16:26:32 ERROR [context.GrailsContextLoaderListener] Error initializing the pplication: Error creating bean with name 'transactionManagerPostProcessor':
.... 
Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: java.util.List

UPDATE

I found the domain and the problem associated with the error. Here's the problem domain and associated List. If I remove the List, the problem is corrected.

class Team {
  List teamTourney

  static hasMany = [ teamTourney: TeamTourney ]
}
3

There are 3 answers

0
dspies On

For anyone that might receive this error in the future you can add

log4j = {
    debug  'org.codehaus.groovy.grails.orm.hibernate.cfg'
}

to the config and it will tell you what class and property is causing the problem.

5
Jeff Scott Brown On

Is this type of list definition not good grails practice?

The code that you show there should be fine. See the project at https://github.com/jeffbrown/integerlist.

0
SeattleStephens On

The problem was a List referencing an undefined field. Among the domains in my project was a type-o in the field name associated with a List. It would be nice if the error message pointed at the location of the error, a point also in this post.

Thanks, Scott.