Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User {
- String name
- static hasOne = [emailProfile: EmailProfile]
- static constraints = {
- emailProfile unique: true, nullable: true
- }
- }
- class EmailProfile {
- String email
- String password
- static belongsTo = [user: User]
- }
- new User(
- name: 'Bob',
- emailProfile: new EmailProfile(email: 'foo@bar.com', password: 'pass')
- ).save(failOnError: true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement