NullPointerException при создании леса таблицы с составным ключом в Grails - PullRequest
0 голосов
/ 04 февраля 2019

У меня есть таблица (БД Oracle 12c), в которой нет столбца с явным идентификатором в Grails (3.3.9), и я хотел бы динамически создать его.Таким образом, я попытался создать составной ключ, состоящий из всех его столбцов (ни один из них не может быть обнуляем), так как это единственный обходной путь, который мне удалось найти, чтобы код выглядел следующим образом:

class AliasFrequencyDict implements Serializable{
    String frequency
    String unit
    String description
    String lang

    static constraints = {
        frequency maxSize: 10, sqlType: 'VARCHAR2'
        unit maxSize: 1, sqlType: 'VARCHAR2'
        description maxSize: 30, sqlType: 'VARCHAR2'
        lang maxSize: 2, sqlType: 'VARCHAR2'
    }

    static mapping = {
        sort 'frequency'
        version false
        id composite: ['frequency', 'unit', 'description', 'lang']
    }
}

В контроллере у меня просто static scaffold = AliasFrequencyDict.Когда я пытаюсь получить доступ к индексу, я получаю java.lang.NullPointerException с сообщением, читающим Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [Byte array resource [view:-,-,aliasFrequencyDict:index]:21] Error executing tag <f:table>: null.Трассировка стека выглядит следующим образом:

    Line | Method
->>  473 | createGroovyPageException    in Byte array resource [view:-,-,aliasFrequencyDict:index]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by GrailsTagException: [Byte array resource [view:-,-,aliasFrequencyDict:index]:21] Error executing tag <f:table>: null
->>   21 | throwRootCause               in Byte array resource [view:-,-,aliasFrequencyDict:index]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by NullPointerException: null
->>   35 | <init>                       in org.grails.scaffolding.model.property.DomainPropertyImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     26 | build                        in org.grails.scaffolding.model.property.DomainPropertyFactoryImpl
|    118 | getListOutputProperties . .  in org.grails.scaffolding.model.DomainModelServiceImpl
|    540 | resolvePersistentProperties  in grails.plugin.formfields.FormFieldsTagLib
|    415 | resolvePropertyNames . . . . in     ''
|    402 | resolveProperties            in     ''
|    230 | doCall . . . . . . . . . . . in grails.plugin.formfields.FormFieldsTagLib$_closure4
|    446 | invokeTagLibClosure          in org.grails.gsp.GroovyPage
|    364 | invokeTag . . . . . . . . .  in     ''
|     54 | doCall                       in Byte_array_resource__view_____aliasFrequencyDict_index_$_run_closure2
|    200 | executeClosure . . . . . . . in org.grails.taglib.TagBodyClosure
|    102 | captureClosureOutput         in     ''
|    213 | call . . . . . . . . . . . . in     ''
|     48 | captureTagContent            in org.grails.plugins.web.taglib.SitemeshTagLib
|    156 | doCall . . . . . . . . . . . in org.grails.plugins.web.taglib.SitemeshTagLib$_closure3
|    446 | invokeTagLibClosure          in org.grails.gsp.GroovyPage
|    364 | invokeTag . . . . . . . . .  in     ''
|     72 | run                          in Byte_array_resource__view_____aliasFrequencyDict_index_
|    162 | doWriteTo . . . . . . . . .  in org.grails.gsp.GroovyPageWritable
|     82 | writeTo                      in     ''
|     76 | renderTemplate . . . . . . . in org.grails.web.servlet.view.GroovyPageView
|     71 | renderWithinGrailsWebRequest in org.grails.web.servlet.view.AbstractGrailsView
|     55 | renderMergedOutputModel . .  in     ''
|    303 | render                       in org.springframework.web.servlet.view.AbstractView
|    150 | renderInnerView . . . . . .  in org.grails.web.sitemesh.GrailsLayoutView
|    128 | obtainContent                in     ''
|     63 | renderTemplate . . . . . . . in     ''
|     71 | renderWithinGrailsWebRequest in org.grails.web.servlet.view.AbstractGrailsView
|     55 | renderMergedOutputModel . .  in     ''
|    303 | render                       in org.springframework.web.servlet.view.AbstractView
|   1286 | render . . . . . . . . . . . in org.springframework.web.servlet.DispatcherServlet
|   1041 | processDispatchResult        in     ''
|    984 | doDispatch . . . . . . . . . in     ''
|    901 | doService                    in     ''
|    970 | processRequest . . . . . . . in org.springframework.web.servlet.FrameworkServlet
|    861 | doGet                        in     ''
|    846 | service . . . . . . . . . .  in     ''
|     55 | doFilterInternal             in org.springframework.boot.web.filter.ApplicationContextHeaderFilter
|     77 | doFilterInternal . . . . . . in org.grails.web.servlet.mvc.GrailsWebRequestFilter
|     67 | doFilterInternal             in org.grails.web.filters.HiddenHttpMethodFilter
|   1149 | runWorker . . . . . . . . .  in java.util.concurrent.ThreadPoolExecutor
|    624 | run                          in java.util.concurrent.ThreadPoolExecutor$Worker
^    748 | run . . . . . . . . . . . .  in java.lang.Thread

Почему это так?Как я могу это исправить, чтобы леса снова заработали?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...