title: GORM Custom Primary Key
body: <p>How to use custom primary key in Grials GORM, i have below domain class :- </p>
  
  <pre><code>class People {
  
      static mapping = {
          version  false
          }
  
      String people_id;
      String name;
      String apppassword;
      String card;
      String role;
      boolean visible;
      String phone;
      byte[] image;
      Date creationTime;
      Date modificationTime;
      static constraints = {
  
          id name: 'people_id', type: 'string'
          people_id(nullable: false )
          name(nullable: false)
          apppassword(nullable: true)
          card(nullable: false)
          role(nullable: false)
          visible(nullable: true)
          phone(nullable: true)
          image(nullable: true)
          creationTime(nullable: true)
          modificationTime(nullable: true)
  
      }
  }
  </code></pre>
  
  <p>and when i run  the server console print below logs (it shows <code>id</code> as a primary key but i want <code>people_id</code> as a primary key) :- </p>
  
  <pre><code>Hibernate: create table people (id bigint not null auto_increment, apppassword varchar(255), card varchar(255) not null, creation_time datetime, image tinyblob, modification_time datetime, name varchar(255) not null, people_id varchar(255) not null, phone varchar(255), role varchar(255) not null, visible bit not null, primary key (id)) ENGINE=InnoDB
  </code></pre>
  
  <p>In MySql my DML is :-</p>
  
  <pre><code>CREATE TABLE PEOPLE (
      PEOPLE_ID VARCHAR(255) NOT NULL,
      NAME VARCHAR(255) NOT NULL,
      APPPASSWORD VARCHAR(255),
      CARD VARCHAR(255),
      ROLE VARCHAR(255),
      VISIBLE BIT DEFAULT b'1' NOT NULL,
      PHONE VARCHAR(255),
      IMAGE MEDIUMBLOB,
      CREATION_TIME DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
      MODIFICATION_TIME DATETIME ON UPDATE CURRENT_TIMESTAMP,
      PRIMARY KEY (PEOPLE_ID)
  )
  </code></pre>
  
  <p>I have followed this <a href="https://stackoverflow.com/questions/10120708/how-to-change-primary-key-column-in-grails">link</a>  , but look like this solution is not working for me.
  Please help</p>