Grails 默认排序关联(双向一对多)

发布于 2024-12-26 09:42:35 字数 741 浏览 1 评论 0原文

我正在尝试对关联进行默认排序,我的域类基本上如下

Class Section{
    Integer displayOrder
    static hasMany=[questionCategories:QuestionCategory]

    static mapping={
        questionCategories sort:'displayOrder'
    }
}

Class QuestionCategory{
    Integer displayOrder
    static hasMany=[questions:Question]

    static mapping={
        questions sort:'displayOrder'
    }
}

Class Question{
    Integer displayOrder
}

我想获取按节类的displayOrder排序的节对象列表,按questionCatgory类的displayOrder排序的内部questionCategories以及按问题类的displayOrder排序的类似问题

I已经尝试过 SortedSet 方法并且工作正常,但不幸的是我们无法将它

与此配置一起使用我收到此错误

java.sql.SQLSyntaxErrorException: ORA-00904: "QUESTIONCA3_"."DISPLAY_ORDER": invalid identifier

I am trying to default sort an association, my domain classes are as follows

Class Section{
    Integer displayOrder
    static hasMany=[questionCategories:QuestionCategory]

    static mapping={
        questionCategories sort:'displayOrder'
    }
}

Class QuestionCategory{
    Integer displayOrder
    static hasMany=[questions:Question]

    static mapping={
        questions sort:'displayOrder'
    }
}

Class Question{
    Integer displayOrder
}

basically i want to get a list of section objects which is sorted by section class's displayOrder, the inner questionCategories sorted by questionCatgory Class's displayOrder and similarly questions sorted by Question class's displayOrder

I have tried SortedSet approach and that works fine, but unfortunately we cannot use it

with this configuration i am getting this error

java.sql.SQLSyntaxErrorException: ORA-00904: "QUESTIONCA3_"."DISPLAY_ORDER": invalid identifier

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

临风闻羌笛 2025-01-02 09:42:35

这看起来像是您的数据库设置不正确。您的基础表之一没有“DISPLAY_ORDER”列。从“QUESTIONCA3_”来看,我猜这是与 QuestionCategory 相关的表。

This looks like your database is not setup correctly. One of your underlying tables doesn't have a "DISPLAY_ORDER" column. Judging by the "QUESTIONCA3_" I'd guess it's the table related to QuestionCategory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文