简体   繁体   中英

What to do if you don't want any domain field to be displayed(int status) in DB. Grails

class Book {

String title
String name
int status

}

If you don't want grails to create the status field in the database, you add static transients = ['status'] to your class.

class Book {
   String title
   String name
   int status

   static transients = ['status']
}

If you want to save status to the database but do not want the Scaffold to display the status on the screen, you can use status display: false in the constaints.

class Book {
   String title
   String name
   int status

   static constraints = {
      status display: false
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM