Browse files

Fix issue where calling validate() after a domain class is reloaded w…

…ith hibernate.reload = false causes NPE
  • Loading branch information...
1 parent a0f21de commit 27685c4205c50080b6f19e844fad747f4b034745 @longwa longwa committed Mar 11, 2013
View
20 ...ain/groovy/org/codehaus/groovy/grails/plugins/orm/hibernate/HibernatePluginSupport.groovy
@@ -379,16 +379,16 @@ Using Grails' default naming strategy: '${ImprovedNamingStrategy.name}'"""
proxyIfReloadEnabled = false
}
}
-
- if(event.source instanceof Class) {
- GrailsDomainClass dc = application.getDomainClass(event.source.name)
- if (!dc.abstract && GrailsHibernateUtil.usesDatasource(dc, datasourceName)) {
- "${dc.fullName}Validator$suffix"(HibernateDomainClassValidator) {
- messageSource = ref("messageSource")
- domainClass = ref("${dc.fullName}DomainClass")
- sessionFactory = ref("sessionFactory$suffix")
- grailsApplication = ref("grailsApplication", true)
- }
+ }
+
+ if(event.source instanceof Class) {
+ GrailsDomainClass dc = application.getDomainClass(event.source.name)
+ if (!dc.abstract && GrailsHibernateUtil.usesDatasource(dc, datasourceName)) {
+ "${dc.fullName}Validator$suffix"(HibernateDomainClassValidator) {
+ messageSource = ref("messageSource")
+ domainClass = ref("${dc.fullName}DomainClass")
+ sessionFactory = ref("sessionFactory$suffix")
+ grailsApplication = ref("grailsApplication", true)
}
}
}

0 comments on commit 27685c4

Please sign in to comment.