在Grails中找到了两个相同集合的表示

时间:2015-10-29 15:35:53

标签: grails

当我使用波纹管代码时看到异常找到相同集合的两个表示。 如何解决这个问题?

class ProductModel implements Serializable{
static auditable = true
String name
Product product
Guarantee guarantee
String status
Integer width
Integer height
Integer weight



static hasMany = [variationValues: VariationValue, prices: Price]

static composites = ["prices"]

static mapping = {
    sort 'id'
    prices cascade: "all-delete-orphan"
    searchKeys type: 'text'
}
在ProductModelController中我有这个代码用于delete()

def delete() {
def pricemodel = Price.findAllByProductModel(productModelInstance).findAll()
pricemodel.each { price ->
    productModelInstance.removeFromPrices(price)
}
productModelInstance.save()
pricemodel.each {
    it.delete()
}

    productModelInstance.delete(flush: true)

0 个答案:

没有答案