用 MappingBuilder 解決 mapping DSL 在 IDEA 中報錯的問題

IDEA 不能正確識別 GORM 中的 mapping block 下的一些方法名,會報告錯誤,例如:
IDEA 不識別 cache 方法
我們可以用 MappingBuilder 來解決這個問題,代碼如下:

import static grails.gorm.hibernate.mapping.MappingBuilder.*
。。。
	static mapping = orm {
		cache enabled: true
	}
。。。
    static final mapping = orm {
        table "rq_feature"
        version false
        autoTimestamp false
        property("bio", [type: "text"])
        property("firstName", {
            column([name: "fn"])
        })
    }

參考

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章