问题
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