File tree 1 file changed +15
-3
lines changed
grails-app/services/au/org/ala/spatial
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import groovy.sql.Sql
20
20
import org.codehaus.jackson.map.DeserializationConfig
21
21
import org.codehaus.jackson.map.ObjectMapper
22
22
import org.postgresql.core.Field
23
+ import org.springframework.transaction.support.TransactionSynchronizationManager
23
24
24
25
import java.sql.ResultSet
25
26
@@ -269,10 +270,21 @@ class FieldService {
269
270
}
270
271
271
272
List<Fields > getFields (boolean includeAdmin = false ) {
272
- if (includeAdmin) {
273
- Fields . findAll()
273
+ // wrap in a transaction if it is not already, unsure why this is necessary for some instances
274
+ if (TransactionSynchronizationManager . isActualTransactionActive()) {
275
+ if (includeAdmin) {
276
+ Fields . findAll()
277
+ } else {
278
+ Fields . findAllByEnabled(true )
279
+ }
274
280
} else {
275
- Fields . findAllByEnabled(true )
281
+ Fields . withTransaction {
282
+ if (includeAdmin) {
283
+ Fields . findAll()
284
+ } else {
285
+ Fields . findAllByEnabled(true )
286
+ }
287
+ }
276
288
}
277
289
}
278
290
You can’t perform that action at this time.
0 commit comments