Grails org.hibernate.AssertionFailure

时间:2013-05-15 10:45:08

标签: hibernate grails groovy

我有一个大问题:

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])

我收到此错误:

  消息[at.ligaportal.User.fanOf   没有被flush()

处理

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

请帮助我!

修正: 我解决了问题:

Game.withNewSession {

}

谢谢

0 个答案:

没有答案