Home hasOne + belongsTo without id in the child
Reply: 0

hasOne + belongsTo without id in the child

user548
1#
user548 Published in April 22, 2018, 10:05 pm

I would like to model a one to one relation in grails (2.4.2).

I do it as described in the documentation like:

class Face {
    static hasOne = [nose: Nose]
}

class Nose {
    static belongsTo = [face: Face]
}

everything is fine, well, nearly...

Now I have 2 fields (id and face_id) "in the Nose".

I would like to have the face_id as the primary key of the Nose.

I would like to suppress the "normal" ID field in the Nose. The face_id field is enough as the key.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301874 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO