0

我有一个大问题:

private void sortCompetitionTable(Round round) {        
        // now sort the table entries and set the table ranks 

        def round_ = Round.get(round.id)
        def teList = CompetitionTableEntry.findAll("from CompetitionTableEntry where round=:round order by tableRank asc", [round:round_], [cache:true])



        teList.sort { a, b ->
            def compareResult = a.points.compareTo(b.points)  * -1
            if (compareResult == 0)
                compareResult = (a.goalsShot-a.goalsReceived).compareTo(b.goalsShot-b.goalsReceived) * -1
            if (compareResult == 0)
                compareResult = a.goalsShot.compareTo(b.goalsShot) * -1
            if (compareResult == 0)
                compareResult = a.team.toString().compareTo(b.team.toString())
            return compareResult
        }

    }

我的问题在这里:

def teList = CompetitionTableEntry.findAll("from CompetitionTableEntry where round=:round order by tableRank asc", [round:round_], [cache:true])

我收到此错误:

org.hibernate.AssertionFailure:集合 [at.ligaportal.User.fanOf] 未由 flush() 处理

我的问题是什么,我从来不需要收集的[at.ligaportal.User.fanOf]

请帮助我!

修复:我解决了以下问题:

Game.withNewSession {

}

谢谢

4

0 回答 0