diff --git a/.travis.yml b/.travis.yml index 8e668fcc..da8c05d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: groovy jdk: -- oraclejdk8 + - oraclejdk8 env: - - GRAILS_VERSION=2.4.0 + - GRAILS_VERSION=2.4.2 before_install: - rm -rf ~/.sdkman diff --git a/application.properties b/application.properties index ee97960e..3e9ca730 100644 --- a/application.properties +++ b/application.properties @@ -1,12 +1,12 @@ #Grails Metadata file -#Mon Aug 24 13:18:39 PDT 2015 +#Wed Nov 04 14:34:48 EST 2015 app.base.majorVersion=7 app.base.prefix=OWF app.base.prevMajorVersion=7 app.base.prevVersion=7.16.1 app.base.sprint= app.base.version=7.17.0 -app.grails.version=2.4.0 +app.grails.version=2.4.2 app.name=owf-server app.notice=${app.notice.ga} app.notice.alpha=This is an Alpha version and has not been fully tested. Any data entered into this system may be lost. An upgrade to the final release will not be provided. To report any bugs, please send an email to goss-support@owfgoss.org. diff --git a/build.xml b/build.xml index 6efb555d..63e3703d 100644 --- a/build.xml +++ b/build.xml @@ -227,10 +227,10 @@ - + diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy index 1e461901..0e0aeb6f 100644 --- a/grails-app/conf/BuildConfig.groovy +++ b/grails-app/conf/BuildConfig.groovy @@ -164,7 +164,7 @@ grails.project.dependency.resolution = { } plugins { compile ':database-migration:1.4.0' - compile ':hibernate:3.6.10.12' + compile ':hibernate:3.6.10.14' compile 'org.ozoneplatform:ozone-appconfig:0.9' compile 'org.ozoneplatform:ozone-auditing:1.2.1' compile 'org.ozoneplatform:ozone-messaging:1.19' diff --git a/grails-app/migrations/changelog.groovy b/grails-app/migrations/changelog.groovy index 3c5027e0..bbd117e1 100644 --- a/grails-app/migrations/changelog.groovy +++ b/grails-app/migrations/changelog.groovy @@ -5,7 +5,7 @@ import grails.util.Holders as CH databaseChangeLog = { //versions for which there are DB changes - def versions = ['3.7.0', '3.8.0', '4.0.0', '5.0.0', '6.0.0', '7.0.0', '7.2.0', '7.3.0', '7.10.0', '7.15.1', '7.16.0'] + def versions = ['3.7.0', '3.8.0', '4.0.0', '5.0.0', '6.0.0', '7.0.0', '7.2.0', '7.3.0', '7.10.0', '7.15.1', '7.16.0', '7.16.1'] // On MS SQL Server, we use numeric(19, 0) for the person id, but we use bigint everywhere else. Use this property like: // column(name: "edited_by_id", type: '${owf.personIdType}') diff --git a/grails-app/migrations/changelog_4.0.0.groovy b/grails-app/migrations/changelog_4.0.0.groovy index 20a773d0..c9f48af7 100644 --- a/grails-app/migrations/changelog_4.0.0.groovy +++ b/grails-app/migrations/changelog_4.0.0.groovy @@ -199,7 +199,8 @@ databaseChangeLog = { changeSet(author: "owf", id: "4.0.0-5", dbms: "postgresql", context: "sampleData, 4.0.0-sampleData") { comment(text="deleting old sample data") - delete(tableName: "role_people") + // DEPRECATED delete as of 7.16.1 where role_people table is removed. + // delete(tableName: "role_people") delete(tableName: "role") delete(tableName: "requestmap") delete(tableName: "preference") @@ -220,7 +221,8 @@ databaseChangeLog = { changeSet(author: "owf", id: "4.0.0-5", dbms: "h2,mysql,mssql,oracle", context: "sampleData, 4.0.0-sampleData") { comment(text="deleting old sample data") - delete(tableName: "role_people") + // DEPRECATED delete as of 7.16.1 where role_people table is removed. + // delete(tableName: "role_people") delete(tableName: "role") delete(tableName: "requestmap") delete(tableName: "preference") @@ -241,7 +243,8 @@ databaseChangeLog = { changeSet(author: "owf", id: "4.0.0-5", dbms: "hsqldb", context: "sampleData, 4.0.0-sampleData") { comment(text="deleting old sample data") - delete(tableName: "role_people") + // DEPRECATED delete as of 7.16.1 where role_people table is removed. + // delete(tableName: "role_people") //for some reason hsqldb will fail if the role table is not all caps delete(tableName: "ROLE") delete(tableName: "requestmap") @@ -3059,32 +3062,29 @@ databaseChangeLog = { // SET IDENTITY_INSERT [dbo].[role_people] ON // """) // } - changeSet(author: "owf", id: "4.0.0-31", context: "sampleData, 4.0.0-sampleData") { - comment(text="insert new sample data") - insert(tableName: "role_people") { - column(name: "role_id", valueNumeric: "26") - - column(name: "person_id", valueNumeric: "2") - } - - insert(tableName: "role_people") { - column(name: "role_id", valueNumeric: "26") - - column(name: "person_id", valueNumeric: "3") - } - - insert(tableName: "role_people") { - column(name: "role_id", valueNumeric: "26") - - column(name: "person_id", valueNumeric: "28") - } - insert(tableName: "role_people") { - column(name: "role_id", valueNumeric: "27") +// DEPRECATED changeset don't use reuse this exact id,contect,dbms combo again +// changeSet(author: "owf", id: "4.0.0-31", context: "sampleData, 4.0.0-sampleData") { +// comment(text="insert new sample data") +// insert(tableName: "role_people") { +// column(name: "role_id", valueNumeric: "26") +// +// column(name: "person_id", valueNumeric: "2") +// } +// insert(tableName: "role_people") { +// column(name: "role_id", valueNumeric: "26") +// column(name: "person_id", valueNumeric: "3") +// } +// insert(tableName: "role_people") { +// column(name: "role_id", valueNumeric: "26") +// column(name: "person_id", valueNumeric: "28") +// } +// insert(tableName: "role_people") { +// column(name: "role_id", valueNumeric: "27") +// column(name: "person_id", valueNumeric: "1") +// } +// } - column(name: "person_id", valueNumeric: "1") - } - } // DEPRECATED changeset don't use reuse this exact id,context,dbms combo again // changeSet(author: "owf", id: "4.0.0-32", dbms:"mssql", context: "sampleData, 4.0.0-sampleData") { // comment(text="allow identity inserts") diff --git a/grails-app/migrations/changelog_7.16.1.groovy b/grails-app/migrations/changelog_7.16.1.groovy index 930cdad7..0320b1e0 100644 --- a/grails-app/migrations/changelog_7.16.1.groovy +++ b/grails-app/migrations/changelog_7.16.1.groovy @@ -6,7 +6,7 @@ databaseChangeLog = { """) } - changeSet(author: 'owf', id: '7.16.1-1', dbms: 'mysql, hsqldb, oracle, mssql, postgresql', context: 'create, upgrade, 7.16.1') { + changeSet(author: 'owf', id: '7.16.1-1', dbms: 'mysql, oracle, mssql, postgresql', context: 'create, upgrade, 7.16.1') { insert(tableName: "role") { column(name: "authority", value: "ROLE_USER") column(name: "description", value: "User Role") @@ -22,11 +22,20 @@ databaseChangeLog = { } } - changeSet(author: "owf", id: "7.16.1-2", dbms:"mssql", context: "create, upgrade, 7.16.1") { - comment(text="allow role inserts") - sql ( text = """ - SET IDENTITY_INSERT [dbo].[role] OFF - """) + changeSet(author: 'owf', id: '7.16.1-1', dbms: 'hsqldb', context: 'create, upgrade, 7.16.1') { + insert(tableName: "ROLE") { + column(name: "authority", value: "ROLE_USER") + column(name: "description", value: "User Role") + column(name: "id", value: "26") + column(name: "version", value: "2") + } + + insert(tableName: "ROLE") { + column(name: "authority", value: "ROLE_ADMIN") + column(name: "description", value: "Admin Role") + column(name: "id", value: "27") + column(name: "version", value: "1") + } } changeSet(author: 'owf', id: "7.16.1-2", context: "create, 7.16.1", dbms: 'postgresql') { diff --git a/grails-app/migrations/changelog_7.17.0.groovy b/grails-app/migrations/changelog_7.17.0.groovy new file mode 100644 index 00000000..31f83a76 --- /dev/null +++ b/grails-app/migrations/changelog_7.17.0.groovy @@ -0,0 +1,23 @@ +databaseChangeLog = { + + changeSet(author: "owf", id: "7.17.0-1", context: "sampleData, 7.17.0-sampleData") { + comment(text="insert new sample data") + insert(tableName: "person_role") { + column(name: "role_id", valueNumeric: "26") + column(name: "person_authorities_id", valueNumeric: "2") + } + insert(tableName: "person_role") { + column(name: "role_id", valueNumeric: "26") + column(name: "person_authorities_id", valueNumeric: "3") + } + insert(tableName: "person_role") { + column(name: "role_id", valueNumeric: "26") + column(name: "person_authorities_id", valueNumeric: "28") + } + insert(tableName: "person_role") { + column(name: "role_id", valueNumeric: "27") + column(name: "person_authorities_id", valueNumeric: "1") + } + } + +} \ No newline at end of file diff --git a/plugins/hibernate-3.6.10.12/src/groovy/grails/plugin/hibernate3/HibernatePluginSupport.groovy b/plugins/hibernate-3.6.10.12/src/groovy/grails/plugin/hibernate3/HibernatePluginSupport.groovy deleted file mode 100644 index 7d7dad44..00000000 --- a/plugins/hibernate-3.6.10.12/src/groovy/grails/plugin/hibernate3/HibernatePluginSupport.groovy +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright 2004-2013 SpringSource. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails.plugin.hibernate3 - -import org.codehaus.groovy.grails.commons.GrailsApplication -import org.codehaus.groovy.grails.commons.GrailsDomainClass -import org.codehaus.groovy.grails.commons.GrailsDomainClassProperty -import org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration -import org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator -import org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration -import org.codehaus.groovy.grails.orm.hibernate.* -import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder -import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil -import org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateUtils -import org.codehaus.groovy.grails.orm.hibernate.events.PatchedDefaultFlushEventListener -import org.codehaus.groovy.grails.orm.hibernate.proxy.HibernateProxyHandler -import org.codehaus.groovy.grails.orm.hibernate.support.* -import org.codehaus.groovy.grails.orm.hibernate.validation.HibernateConstraintsEvaluator -import org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator -import org.codehaus.groovy.grails.orm.hibernate.validation.PersistentConstraintFactory -import org.codehaus.groovy.grails.orm.hibernate.validation.UniqueConstraint -import org.codehaus.groovy.grails.validation.ConstrainedProperty -import org.codehaus.groovy.grails.validation.ConstraintsEvaluator -import org.grails.datastore.mapping.model.MappingContext -import org.hibernate.EmptyInterceptor -import org.hibernate.cfg.ImprovedNamingStrategy -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.beans.factory.config.BeanDefinition -import org.springframework.beans.factory.config.PropertiesFactoryBean -import org.springframework.beans.factory.support.DefaultListableBeanFactory -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader -import org.springframework.context.ApplicationContext -import org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor -import org.springframework.orm.hibernate3.HibernateAccessor -import org.springframework.transaction.PlatformTransactionManager - -/** - * Implements the core parts of GORM. - * - * @author Graeme Rocher - * @since 1.1 - */ -class HibernatePluginSupport { - - static final Logger LOG = LoggerFactory.getLogger(this) - static final int RELOAD_RETRY_LIMIT = 3 - - static GrailsDomainBinder grailsDomainBinder = new GrailsDomainBinder() - - static doWithSpring = { - - if (getSpringConfig().containsBean(ConstraintsEvaluator.BEAN_NAME)) { - delegate."${ConstraintsEvaluator.BEAN_NAME}".constraintsEvaluatorClass = HibernateConstraintsEvaluator - } - - def vendorToDialect = new Properties() - def hibernateDialects = application.classLoader.getResource("hibernate-dialects.properties") - if (hibernateDialects) { - def p = new Properties() - p.load(hibernateDialects.openStream()) - for (entry in p) { - vendorToDialect[entry.value] = "org.hibernate.dialect.${entry.key}".toString() - } - } - - def datasourceNames = [] - if (getSpringConfig().containsBean('dataSource')) { - datasourceNames << GrailsDomainClassProperty.DEFAULT_DATA_SOURCE - } - - for (name in application.config.keySet()) { - if (name.startsWith('dataSource_')) { - datasourceNames << name - 'dataSource_' - } - } - - ConstrainedProperty.registerNewConstraint(UniqueConstraint.UNIQUE_CONSTRAINT, - new PersistentConstraintFactory(getSpringConfig().getUnrefreshedApplicationContext(), - UniqueConstraint)) - - proxyHandler(HibernateProxyHandler) - - eventTriggeringInterceptor(ClosureEventTriggeringInterceptor) - - nativeJdbcExtractor(CommonsDbcpNativeJdbcExtractor) - - hibernateEventListeners(HibernateEventListeners) - - persistenceInterceptor(AggregatePersistenceContextInterceptor) - - for (String datasourceName in datasourceNames) { - LOG.debug "processing DataSource $datasourceName" - boolean isDefault = datasourceName == GrailsDomainClassProperty.DEFAULT_DATA_SOURCE - String suffix = isDefault ? '' : '_' + datasourceName - String prefix = isDefault ? '' : datasourceName + '_' - - for (GrailsDomainClass dc in application.domainClasses) { - - if (!dc.abstract && GrailsHibernateUtil.isMappedWithHibernate(dc) && GrailsHibernateUtil.usesDatasource(dc, datasourceName)) { - "${dc.fullName}Validator$suffix"(HibernateDomainClassValidator) { - messageSource = ref("messageSource") - domainClass = ref("${dc.fullName}DomainClass") - grailsApplication = ref("grailsApplication", true) - sessionFactory = ref("sessionFactory$suffix") - } - } - } - - def ds = application.config["dataSource$suffix"] - if (isDefault) { - BeanDefinition externalDefinition = checkExternalBeans(application) - if (externalDefinition && !ds) { - ds = new ConfigObject() - application.config.dataSource = ds - } - } - - def hibConfig = application.config["hibernate$suffix"] ?: application.config.hibernate - - def hibConfigClass = ds?.configClass - def hibProps = [:] - - if (ds.loggingSql || ds.logSql) { - hibProps."hibernate.show_sql" = "true" - } - if (ds.formatSql) { - hibProps."hibernate.format_sql" = "true" - } - - if (ds.dialect) { - if (ds.dialect instanceof Class) { - hibProps."hibernate.dialect" = ds.dialect.name - } - else { - hibProps."hibernate.dialect" = ds.dialect.toString() - } - } - else { - "dialectDetector$suffix"(HibernateDialectDetectorFactoryBean) { - dataSource = ref("dataSource$suffix") - vendorNameDialectMappings = vendorToDialect - } - hibProps."hibernate.dialect" = ref("dialectDetector$suffix") - } - - hibProps."hibernate.hbm2ddl.auto" = ds.dbCreate ?: '' - - LOG.info "Set db generation strategy to '${hibProps.'hibernate.hbm2ddl.auto'}' for datasource $datasourceName" - - if (hibConfig) { - def cacheProvider = hibConfig.cache?.provider_class - if (cacheProvider) { - if (cacheProvider.contains('OSCacheProvider')) { - try { - def cacheClass = getClass().classLoader.loadClass(cacheProvider) - } - catch (Throwable t) { - hibConfig.cache.region.factory_class='net.sf.ehcache.hibernate.EhCacheRegionFactory' - log.error """WARNING: Your cache provider is set to '${cacheProvider}' in DataSource.groovy, however the class for this provider cannot be found. -Using Grails' default cache region factory: 'net.sf.ehcache.hibernate.EhCacheRegionFactory'""" - } - } else if (!(hibConfig.cache.useCacheProvider) && (cacheProvider=='org.hibernate.cache.EhCacheProvider' || cacheProvider=='net.sf.ehcache.hibernate.EhCacheProvider')) { - hibConfig.cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' - hibConfig.cache.remove('provider_class') - if (hibConfig.cache.provider_configuration_file_resource_path) { - hibProps.'net.sf.ehcache.configurationResourceName' = hibConfig.cache.provider_configuration_file_resource_path - hibConfig.cache.remove('provider_configuration_file_resource_path') - } - } - } - - def namingStrategy = hibConfig.naming_strategy ?: ImprovedNamingStrategy - try { - grailsDomainBinder.configureNamingStrategy datasourceName, namingStrategy - } - catch (Throwable t) { - log.error """WARNING: You've configured a custom Hibernate naming strategy '$namingStrategy' in DataSource.groovy, however the class cannot be found. -Using Grails' default naming strategy: '${ImprovedNamingStrategy.name}'""" - grailsDomainBinder.configureNamingStrategy datasourceName, ImprovedNamingStrategy - } - - // allow adding hibernate properties that don't start with "hibernate." - if (hibConfig.get('properties') instanceof ConfigObject) { - def hibernateProperties = hibConfig.remove('properties') - hibProps.putAll(hibernateProperties.flatten().toProperties()) - } - - hibProps.putAll(hibConfig.flatten().toProperties('hibernate')) - hibProps.remove('hibernate.reload') - hibProps.remove('hibernate.singleSession') - - // move net.sf.ehcache.configurationResourceName to "top level" if it exists - if (hibProps.'hibernate.net.sf.ehcache.configurationResourceName') { - hibProps.'net.sf.ehcache.configurationResourceName' = hibProps.remove('hibernate.net.sf.ehcache.configurationResourceName') - } - } - - "hibernateProperties$suffix"(PropertiesFactoryBean) { bean -> - bean.scope = "prototype" - properties = hibProps - } - - "lobHandlerDetector$suffix"(SpringLobHandlerDetectorFactoryBean) { - dataSource = ref("dataSource$suffix") - pooledConnection = ds.pooled ?: false - nativeJdbcExtractor = ref("nativeJdbcExtractor") - } - - "entityInterceptor$suffix"(EmptyInterceptor) - - "abstractSessionFactoryBeanConfig$suffix" { - dataSource = ref("dataSource$suffix") - dataSourceName = datasourceName - sessionFactoryBeanName = "sessionFactory$suffix" - - List hibConfigLocations = [] - if (application.classLoader.getResource(prefix + 'hibernate.cfg.xml')) { - hibConfigLocations << 'classpath:' + prefix + 'hibernate.cfg.xml' - } - def explicitLocations = hibConfig?.config?.location - if (explicitLocations) { - if (explicitLocations instanceof Collection) { - hibConfigLocations.addAll(explicitLocations.collect { it.toString() }) - } - else { - hibConfigLocations << hibConfig.config.location.toString() - } - } - configLocations = hibConfigLocations - - if (hibConfigClass) { - configClass = ds.configClass - } - - hibernateProperties = ref("hibernateProperties$suffix") - - grailsApplication = ref("grailsApplication", true) - - lobHandler = ref("lobHandlerDetector$suffix") - - entityInterceptor = ref("entityInterceptor$suffix") - - eventListeners = ['flush': new PatchedDefaultFlushEventListener(), - 'save': eventTriggeringInterceptor, - 'save-update': eventTriggeringInterceptor, - 'pre-load': eventTriggeringInterceptor, - 'post-load': eventTriggeringInterceptor, - 'pre-insert': eventTriggeringInterceptor, - 'post-insert': eventTriggeringInterceptor, - 'pre-update': eventTriggeringInterceptor, - 'post-update': eventTriggeringInterceptor, - 'pre-delete': eventTriggeringInterceptor, - 'post-delete': eventTriggeringInterceptor] - - hibernateEventListeners = ref('hibernateEventListeners') - - transactionManager = new PlatformTransactionManagerProxy() - } - - if (grails.util.Environment.current.isReloadEnabled()) { - "${SessionFactoryHolder.BEAN_ID}$suffix"(SessionFactoryHolder) - } - "sessionFactory$suffix"(ConfigurableLocalSessionFactoryBean) { bean -> - bean.parent = 'abstractSessionFactoryBeanConfig' + suffix - } - - "transactionManager$suffix"(GrailsHibernateTransactionManager) { - sessionFactory = ref("sessionFactory$suffix") - } - - "hibernateDatastore$suffix"(HibernateDatastore, ref('grailsDomainClassMappingContext'), ref("sessionFactory$suffix"), application.config) - - if (manager?.hasGrailsPlugin("controllers")) { - "flushingRedirectEventListener$suffix"(FlushOnRedirectEventListener, ref("sessionFactory$suffix")) - - "openSessionInViewInterceptor$suffix"(GrailsOpenSessionInViewInterceptor) { - - if (Boolean.TRUE.equals(ds.readOnly)) { - flushMode = HibernateAccessor.FLUSH_NEVER - } - else if (hibConfig.flush.mode instanceof String) { - switch(hibConfig.flush.mode) { - case "manual": flushMode = HibernateAccessor.FLUSH_NEVER; break - case "always": flushMode = HibernateAccessor.FLUSH_ALWAYS; break - case "commit": flushMode = HibernateAccessor.FLUSH_COMMIT; break - default: flushMode = HibernateAccessor.FLUSH_AUTO - } - } - else { - flushMode = HibernateAccessor.FLUSH_AUTO - } - sessionFactory = ref("sessionFactory$suffix") - - if(hibConfig?.containsKey('singleSession')) { - singleSession = hibConfig.singleSession as Boolean - } - } - - if (getSpringConfig().containsBean("controllerHandlerMappings")) { - controllerHandlerMappings.interceptors << ref("openSessionInViewInterceptor$suffix") - } - if (getSpringConfig().containsBean("annotationHandlerMapping")) { - if (annotationHandlerMapping.interceptors) { - annotationHandlerMapping.interceptors << ref("openSessionInViewInterceptor$suffix") - } - else { - annotationHandlerMapping.interceptors = [ref("openSessionInViewInterceptor$suffix")] - } - } - } - } - } - - static final onChange = { event -> - LOG.debug "onChange() started" - - def allDatasourceNames = [GrailsDomainClassProperty.DEFAULT_DATA_SOURCE] as Set - for (name in application.config.keySet()) { - if (name.startsWith('dataSource_')) { - allDatasourceNames << name - 'dataSource_' - } - } - - def datasourceNames - if (event.source instanceof Class) { - GrailsDomainClass dc = application.getDomainClass(event.source.name) - if (!dc || !GrailsHibernateUtil.isMappedWithHibernate(dc)) { - return - } - grailsDomainBinder.clearMappingCache(event.source) - def dcMappingDsNames = GrailsHibernateUtil.getDatasourceNames(dc) as Set - datasourceNames = [] as Set - for(name in allDatasourceNames) { - if (name in dcMappingDsNames || dcMappingDsNames.contains(GrailsDomainClassProperty.ALL_DATA_SOURCES)) { - datasourceNames << name - } - } - } else { - grailsDomainBinder.clearMappingCache() - datasourceNames = allDatasourceNames - } - - def beans = beans { - for (String datasourceName in datasourceNames) { - LOG.debug "processing DataSource $datasourceName" - boolean isDefault = datasourceName == GrailsDomainClassProperty.DEFAULT_DATA_SOURCE - String suffix = isDefault ? '' : '_' + datasourceName - def hibConfig = application.config["hibernate$suffix"] - def sessionFactoryReload = hibConfig?.containsKey('reload') ? hibConfig.reload : true - - if (sessionFactoryReload) { - "${SessionFactoryHolder.BEAN_ID}$suffix"(SessionFactoryHolder) { - sessionFactory = bean(ConfigurableLocalSessionFactoryBean) { bean -> - bean.parent = ref("abstractSessionFactoryBeanConfig$suffix") - 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) - } - } - } - } - } - - ApplicationContext ctx = event.ctx - beans.registerBeans(ctx) - - if (event.source instanceof Class) { - def mappingContext = ctx.getBean("grailsDomainClassMappingContext", MappingContext) - def entity = mappingContext.addPersistentEntity(event.source, true) - } - - int retryCount = 0 - - def enhanceAndTest = { - // Re-enhance the given class - HibernateUtils.enhanceSessionFactories(ctx, application, event.source) - - // Due to quantum tunneling and other class loader race conditions, attempts to - // enhance the entities may not work. Check a few static and non-static methods to see if it worked. - boolean hasMethods = event.source.metaClass.methods.any { MetaMethod method -> - method.name.startsWith("addTo") || - method.name.startsWith("list") || - method.name.startsWith("get") || - method.name.startsWith("count") - } - - if (!hasMethods) { - if (++retryCount < RELOAD_RETRY_LIMIT) { - LOG.debug("Attempt ${retryCount} at enhancing ${event.source.name} failed, waiting and trying again") - sleep(retryCount * 1000) - enhanceAndTest() - } - } - } - - // Enhance the reloaded GORM objects - enhanceAndTest() - - LOG.info "onChange() complete" - } - - static final doWithDynamicMethods = { ApplicationContext ctx -> - def grailsApplication = application - HibernateUtils.enhanceSessionFactories(ctx, grailsApplication) - } - - private static checkExternalBeans(GrailsApplication application) { - ApplicationContext parent = application.parentContext - try { - def resourcesXml = parent?.getResource(GrailsRuntimeConfigurator.SPRING_RESOURCES_XML) - if (resourcesXml && resourcesXml.exists()) { - def xmlBeans = new DefaultListableBeanFactory() - new XmlBeanDefinitionReader(xmlBeans).loadBeanDefinitions(resourcesXml) - if (xmlBeans.containsBean("dataSource")) { - LOG.info("Using dataSource bean definition from ${GrailsRuntimeConfigurator.SPRING_RESOURCES_XML}") - return xmlBeans.getMergedBeanDefinition("dataSource") - } - } - } catch (FileNotFoundException fnfe) { - // that's ok external resources file not required - } - - // Check resources.groovy - RuntimeSpringConfiguration springConfig = new DefaultRuntimeSpringConfiguration(parent,application.classLoader) - GrailsRuntimeConfigurator.loadExternalSpringConfig(springConfig, application) - if (springConfig.containsBean("dataSource")) { - LOG.info("Using dataSource bean definition from ${GrailsRuntimeConfigurator.SPRING_RESOURCES_GROOVY}") - return springConfig.getBeanDefinition("dataSource") - } - return null - } - - static doWithApplicationContext = { ApplicationContext ctx -> - if(ctx.containsBean("transactionManager")) { - PlatformTransactionManager transactionManager = ctx.getBean("transactionManager", PlatformTransactionManager) - ctx.getBeansOfType(ConfigurableLocalSessionFactoryBean).each { String beanName, ConfigurableLocalSessionFactoryBean sessionFactory -> - if(sessionFactory.transactionManager instanceof PlatformTransactionManagerProxy) { - sessionFactory.transactionManager.targetTransactionManager = transactionManager - } - } - } - } -} diff --git a/plugins/hibernate-3.6.10.12/src/groovy/grails/plugin/hibernate3/PlatformTransactionManagerProxy.java b/plugins/hibernate-3.6.10.12/src/groovy/grails/plugin/hibernate3/PlatformTransactionManagerProxy.java deleted file mode 100644 index 1b618199..00000000 --- a/plugins/hibernate-3.6.10.12/src/groovy/grails/plugin/hibernate3/PlatformTransactionManagerProxy.java +++ /dev/null @@ -1,34 +0,0 @@ -package grails.plugin.hibernate3; - -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionException; -import org.springframework.transaction.TransactionStatus; - -public class PlatformTransactionManagerProxy implements PlatformTransactionManager { - private PlatformTransactionManager targetTransactionManager; - - public PlatformTransactionManagerProxy() { - - } - - public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException { - return targetTransactionManager.getTransaction(definition); - } - - public void commit(TransactionStatus status) throws TransactionException { - targetTransactionManager.commit(status); - } - - public void rollback(TransactionStatus status) throws TransactionException { - targetTransactionManager.rollback(status); - } - - public PlatformTransactionManager getTargetTransactionManager() { - return targetTransactionManager; - } - - public void setTargetTransactionManager(PlatformTransactionManager targetTransactionManager) { - this.targetTransactionManager = targetTransactionManager; - } -} diff --git a/plugins/hibernate-3.6.10.12/HibernateGrailsPlugin.groovy b/plugins/hibernate-3.6.10.14/HibernateGrailsPlugin.groovy similarity index 98% rename from plugins/hibernate-3.6.10.12/HibernateGrailsPlugin.groovy rename to plugins/hibernate-3.6.10.14/HibernateGrailsPlugin.groovy index eec731f5..4fff9f34 100644 --- a/plugins/hibernate-3.6.10.12/HibernateGrailsPlugin.groovy +++ b/plugins/hibernate-3.6.10.14/HibernateGrailsPlugin.groovy @@ -27,7 +27,7 @@ class HibernateGrailsPlugin { def description = "Provides integration between Grails and Hibernate 3 through GORM" def grailsVersion = "2.3.2 > *" - def version = "3.6.10.12" + def version = "3.6.10.14" def observe = ['domainClass'] def loadAfter = ['controllers', 'domainClass'] def watchedResources = ["file:./grails-app/conf/hibernate/**.xml"] diff --git a/plugins/hibernate-3.6.10.12/LICENSE b/plugins/hibernate-3.6.10.14/LICENSE similarity index 100% rename from plugins/hibernate-3.6.10.12/LICENSE rename to plugins/hibernate-3.6.10.14/LICENSE diff --git a/plugins/hibernate-3.6.10.12/application.properties b/plugins/hibernate-3.6.10.14/application.properties similarity index 79% rename from plugins/hibernate-3.6.10.12/application.properties rename to plugins/hibernate-3.6.10.14/application.properties index c3092f37..71c21c18 100644 --- a/plugins/hibernate-3.6.10.12/application.properties +++ b/plugins/hibernate-3.6.10.14/application.properties @@ -1,5 +1,5 @@ #Grails Metadata file #Fri Oct 18 07:57:19 CDT 2013 -app.grails.version=2.3.7 +app.grails.version=2.3.8 app.name=hibernate app.servlet.version=2.5 diff --git a/plugins/hibernate-3.6.10.12/grails-app/i18n/messages.properties b/plugins/hibernate-3.6.10.14/grails-app/i18n/messages.properties similarity index 100% rename from plugins/hibernate-3.6.10.12/grails-app/i18n/messages.properties rename to plugins/hibernate-3.6.10.14/grails-app/i18n/messages.properties diff --git a/plugins/hibernate-3.6.10.12/plugin.xml b/plugins/hibernate-3.6.10.14/plugin.xml similarity index 78% rename from plugins/hibernate-3.6.10.12/plugin.xml rename to plugins/hibernate-3.6.10.14/plugin.xml index 4bab005a..210da8d4 100644 --- a/plugins/hibernate-3.6.10.12/plugin.xml +++ b/plugins/hibernate-3.6.10.14/plugin.xml @@ -1,4 +1,4 @@ - + Graeme Rocher Hibernate 3 for Grails Provides integration between Grails and Hibernate 3 through GORM diff --git a/plugins/hibernate-3.6.10.12/scripts/CreateHibernateCfgXml.groovy b/plugins/hibernate-3.6.10.14/scripts/CreateHibernateCfgXml.groovy similarity index 100% rename from plugins/hibernate-3.6.10.12/scripts/CreateHibernateCfgXml.groovy rename to plugins/hibernate-3.6.10.14/scripts/CreateHibernateCfgXml.groovy diff --git a/plugins/hibernate-3.6.10.12/scripts/SchemaExport.groovy b/plugins/hibernate-3.6.10.14/scripts/SchemaExport.groovy similarity index 100% rename from plugins/hibernate-3.6.10.12/scripts/SchemaExport.groovy rename to plugins/hibernate-3.6.10.14/scripts/SchemaExport.groovy diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/attach.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/attach.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/attach.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/attach.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/delete.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/delete.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/delete.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/delete.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/discard.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/discard.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/discard.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/discard.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/getDirtyPropertyNames.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/getDirtyPropertyNames.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/getDirtyPropertyNames.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/getDirtyPropertyNames.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/getPersistentValue.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/getPersistentValue.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/getPersistentValue.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/getPersistentValue.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/instanceOf.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/instanceOf.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/instanceOf.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/instanceOf.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/isAttached.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/isAttached.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/isAttached.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/isAttached.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/isDirty.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/isDirty.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/isDirty.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/isDirty.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/lock.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/lock.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/lock.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/lock.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/merge.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/merge.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/merge.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/merge.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/methodMissing.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/methodMissing.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/methodMissing.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/methodMissing.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/refresh.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/refresh.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/refresh.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/refresh.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/save.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/save.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/save.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/save.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/docs/ref/Domain/validate.gdoc b/plugins/hibernate-3.6.10.14/src/docs/ref/Domain/validate.gdoc similarity index 100% rename from plugins/hibernate-3.6.10.12/src/docs/ref/Domain/validate.gdoc rename to plugins/hibernate-3.6.10.14/src/docs/ref/Domain/validate.gdoc diff --git a/plugins/hibernate-3.6.10.12/src/java/hibernate.cfg.xml b/plugins/hibernate-3.6.10.14/src/java/hibernate.cfg.xml similarity index 100% rename from plugins/hibernate-3.6.10.12/src/java/hibernate.cfg.xml rename to plugins/hibernate-3.6.10.14/src/java/hibernate.cfg.xml