Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix issue where calling validate() after a domain class is reloaded with... #336

Merged
merged 1 commit into from Mar 13, 2013

Conversation

Projects
None yet
4 participants

longwa commented Mar 11, 2013

... hibernate.reload = false causes NPE

In testing the hibernate.reload = false changes, I found that validate() throws an NPE b/c the GrailsDomainClass reference is not valid unless the Validator bean is registered again. This change moves the Validator re-register out of the check for reloading. In my testing, it didn't add any significant time to the reload and I was able to reload and save(), get(), etc. the class with no problems.

Owner

jeffbrown commented Mar 11, 2013

Are there any unit tests for this?

@ghost ghost assigned jeffbrown Mar 11, 2013

longwa commented Mar 11, 2013

I'm not exactly sure how to write a unit test which tests the reload functionality. I guess the HibernatePluginSupport.onChange() method could be invoked directly and the pre and post beans spring beans compared to see if they changed (or didn't change)?

longwa commented Mar 11, 2013

Actually, I don't see any tests for HibernatePluginSupport (not directly). A few of the uber tests create mocks plugins which call methods on it, but no official tests.

Member

lhotari commented Mar 12, 2013

I suggest that we apply Aaron's commit since this feature has been already included in released Grails versions without documentation, there is http://jira.grails.org/browse/GRAILS-9412 open for this "reload = false" feature for disabling Hibernate sessionfactory re-initialization after making changes.

@ghost ghost assigned graemerocher Mar 13, 2013

graemerocher added a commit that referenced this pull request Mar 13, 2013

Merge pull request #336 from longwa/GRAILS-9412
Fix issue where calling validate() after a domain class is reloaded with...

@graemerocher graemerocher merged commit 105c135 into grails:2.2.x Mar 13, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment