Grails Domain Classes id
When creating objects in my domain class, id is automatically created - and in my sql database, it is created a column called id as well.
I want that column to be named, for example, "book_id" in class book and "movie_id" in class movie. My quest开发者_开发问答ion is, how can i change the name?
You can explicitly declare the name of the identifier column using mapping like this:
class Book {
  ..
  static mapping = {
    id column:'book_id'
  }
}
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论