Using an uuid or guid as id in grails/hibernate -


i need have guid/uuid's id column of rows.

this able create entries both online , offline, , of course not having these conflict on pk when merging. know mitigate this, i'd keep simple, , there legacy apps using uuid/guids define relationships). data needs synced both ways later. rewriting existing applications not option.

when try use either guid or uuid grails error 500. (using guid on h2 results in error - detaling db not support guids, expected).

i error when try save 'withuuid':

uri    /gtestuuid/withuuid/save class    java.lang.illegalargumentexception message    argument type mismatch 

entire error 500: http://imgur.com/m2udbm6.png

i've tried mariadb 5.5 , 1.1.7 driver, results in same problem.

grails 2.3.8. windows 8.1 (x64). netbeans 7.4

all default.

example classes:

withuuid.groovy:

package gtestuuid  class withuuid {     string name     static constraints = {     }     static mapping = {         id generator: 'uuid'     } } 

withuuidcontroller.groovy:

package gtestuuid  class withuuidcontroller {     def scaffold = withuuid } 

any appreciated.

link relevant grails documentation

(i'm not able post links more docs/posts due low rep)

you need set id string or uuid (or need).

below, example of class user possibility:

import java.util.uuid  class user {      string id = uuid.randomuuid().tostring()      static mapping = {         id generator:'assigned'     } } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -