小编use*_*352的帖子

Grails/Hibernate:不存在具有给定标识符的行

我有一个域名如下:

class Author {
    String id
    static hasMany = [accounts: Account]
    static belongsTo = Account
    static mapping = {
        accounts joinTable: [name: "SOMETABLE", key: 'SOMEFIELD'], 
                 ignoreNotFound: true
    }
    static constraints = {}
}
Run Code Online (Sandbox Code Playgroud)

没有找到记录时,我收到以下错误.我尝试了ignoreNotFound,它无法正常工作.

error message: accounts=org.hibernate.ObjectNotFoundException: 
No row with the given identifier exists: 
[com.myapplication.Account#123465489785]
Run Code Online (Sandbox Code Playgroud)

尝试选择您无权在数据库中插入的连接2记录时会发生这种情况.请问有解决方法吗?

java grails hibernate grails-orm grails-domain-class

6
推荐指数
1
解决办法
1万
查看次数