Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change primary key column in grails?

I have a domain class having an Integer variable 'code'. my requirement is to make 'code', primary key column for that domain and also auto increment and to remove the default 'id' column from the table created for that doamin.thnks

like image 953
A B Avatar asked Apr 12 '12 09:04

A B


1 Answers

use this :

static mapping = {
id name: 'code'
}

more informations here : http://grails.org/doc/2.0.x/ref/Database%20Mapping/id.html

like image 88
Ahmed Laatabi Avatar answered Sep 27 '22 17:09

Ahmed Laatabi