In an effort to make the grails cache ehcache plugin work with both Hibernate 3 and 4, I dynamically load and define a class. I need to dynamically define and load the class as the Hibernate 3 class won't compile if Hibernate 3 isn't available, and the Hibernate 4 class won't compile if Hibernate 4 isn't available, and one cannot have both Hibernate 3 and Hibernate 4 available at the same time.
I feel like I've made this harder than it should be. Would one of you mind taking a look to see if there's a better way to accomplish this goal?
https://github.com/grails-plugins/grails-cache-ehcache/blob/v1.0.2/CacheEhcacheGrailsPlugin.groovy#L165I'm also curious if there are any potential problems with what I've done.
Thank you,
~Craig