Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Commit f1d02b6

Browse files
committed
Fix tests. Only support GORM 6.1+
1 parent 8df84ef commit f1d02b6

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

core/src/main/groovy/org/grails/gorm/graphql/fetcher/DefaultGormDataFetcher.groovy

+1-16
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,10 @@ abstract class DefaultGormDataFetcher<T> implements DataFetcher<T> {
119119
datastore = this.datastore
120120
}
121121

122-
//To support older versions of GORM
123-
try {
124-
Method getTransactionManager = datastore.class.getMethod('getTransactionManager', (Class<?>[]) null)
125-
PlatformTransactionManager transactionManager = (PlatformTransactionManager)getTransactionManager.invoke(datastore)
126-
CustomizableRollbackTransactionAttribute transactionAttribute = new CustomizableRollbackTransactionAttribute()
127-
transactionAttribute.setReadOnly(readOnly)
128-
new GrailsTransactionTemplate(transactionManager, transactionAttribute).execute(closure)
129-
} catch (NoSuchMethodException | SecurityException e) {
130-
log.error('Unable to find a transaction manager for datastore {}', datastore.class.name)
131-
null
132-
}
133-
134-
//Supports 6.1.x+ only
135-
/*
136-
TransactionService txService = (TransactionService)datastore.getService((Class<?>)TransactionService)
122+
TransactionService txService = datastore.getService(TransactionService)
137123
CustomizableRollbackTransactionAttribute transactionAttribute = new CustomizableRollbackTransactionAttribute()
138124
transactionAttribute.setReadOnly(readOnly)
139125
txService.withTransaction(transactionAttribute, closure)
140-
*/
141126
}
142127

143128
abstract T get(DataFetchingEnvironment environment)

examples/spring-boot-app/src/main/groovy/com/example/demo/DemoApplication.groovy

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired
88
import org.springframework.boot.SpringApplication
99
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
1010
import org.springframework.boot.autoconfigure.SpringBootApplication
11+
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
1112
import org.springframework.context.annotation.Bean
1213
import org.springframework.context.annotation.ComponentScan
1314

14-
@EnableAutoConfiguration
15+
@EnableAutoConfiguration(exclude = [HibernateJpaAutoConfiguration])
1516
@ComponentScan
1617
@CompileStatic
1718
@SpringBootApplication

0 commit comments

Comments
 (0)