Grails Entity without persist

孤街浪徒 提交于 2019-12-01 04:38:41

问题


I have a domain class in grails... How do I get gorm to leave out this entity when it create the db? Just leave it alone.


回答1:


If i understood, u want not create table from domain class? If yes, use this code inside domain class:

static mapWith = "none" // disable persisting into database



回答2:


Sounds like you don't need it to be a domain class then. You could just make it a POGO in the src/groovy file. If my assumptions here are wrong please explain further what you're trying to accomplish.




回答3:


You could use Command Objects.

http://grails.org/doc/latest/guide/single.html#commandObjects

They provide the data binding and validation of domain classes, but do not map to the database.



来源:https://stackoverflow.com/questions/8898843/grails-entity-without-persist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!