Tag: gorm

在Grails中发布嵌套资源的问题

我在理解Grails Restful控制器如何工作方面遇到了问题。 我正在尝试向嵌套资源发出post请求(见下文)。 我不确定我是否理解我需要更改以使其工作,因为看起来GET请求与其父资源项建立Bid的关联,但是当我尝试POST时,我被警告该项不能为空。 任何帮助表示赞赏! Item.groovy class Item { static hasMany = [bids:Bid] } Bid.groovy class Bid { Integer ownerId Double amount static belongsTo = [item:Item] static constraints = { ownerId nullable: false amount nullable: false } } BidController.groovy class BidController extends RestfulController { static responseFormats = [‘json’, ‘xml’] BidController() { super(Bid) } @Override def […]

相当于Grails中的InheritanceType.TABLE_PER_CLASS?

我想为3个域类创建3个单独的表:A,B扩展A,C扩展B但是我希望它们的表不相互连接。 在hibernate中,我会在grails中使用InheritanceType.TABLE_PER_CLASS,它会等同于什么?

Hibernate / GORM:flush()不处理集合

我在Grails应用程序中进行了集成测试,当我尝试保存Member类型的实体时失败 invitingMember.save(flush: true) 这引发了以下exception org.hibernate.AssertionFailure:在com.mycompany.member.MemberConnectionService.addOrUpdateContact(MemberConnectionService.groovy:939)中,flush()未处理集合[com.mycompany.facet.Facet.channels]。 在事务的早期,我将一个对象添加到invitingMember的集合属性中。 我的猜测是exception是在上面的行中引发的,因为只有在这一点上才会保留添加到集合中的对象。