Is it possible for a Grails Domain to have no 'id'?
Posted
by firnnauriel
on Stack Overflow
See other posts from Stack Overflow
or by firnnauriel
Published on 2010-04-06T05:49:33Z
Indexed on
2010/04/06
5:53 UTC
Read the original article
Hit count: 179
Is it possible to create a table that has no 'id'? For example, this is my domain:
class SnbrActVector {
int nid
String term
double weight
static mapping = {
version false
id generator: 'identity'
}
static constraints = {
}
}
When I run this SQL statement, it fails:
insert into snbr_act_vector values (5, 'term', 0.5)
I checked the table and 'id' is already set to autoincrement. I'm thinking that another option is to remove the 'id' itself. Or is there another workaround for this? Please assume that it is not an option to change the givent SQL statement.
© Stack Overflow or respective owner