Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

grailsinaction chapter 3 problems with 1:1 mapping

See attached files for user and profile domains.

Once I add the profile to the user, when I try to create user data with the following line in the console: new com.grailsinaction.Guser (userId: 'joeeeee', password: 'secret').save(), I get the result : Execution Complete. Result is null and no records are committed to the database.

I cannot see what I'm doing wrong. Guser.groovy.txt Profile.groovy.txt
0
Melodi Roberts
Asked:
Melodi Roberts
  • 2
1 Solution
 
Melodi RobertsProgrammer/AnalystAuthor Commented:
Here is some additional information.  Below is what the generated database table looks like. Shouldn't the profile_id be NOT NULL?

I have configuration set to create-drop, so I know it should be picking up these changes to the Guser domain.

ID                                        NOT NULL NUMBER(19)
VERSION                                   NOT NULL NUMBER(19)
DATE_CREATED                              NOT NULL TIMESTAMP(6)
PASSWORD                                  NOT NULL VARCHAR2(255 CHAR)
PROFILE_ID                                NOT NULL NUMBER(19)
USER_ID                                   NOT NULL VARCHAR2(255 CHAR)
0
 
schwertnerCommented:
You enter values for only two columns in your table.
But all columns have NOT NULL constraints.
So you have either to insert six non null values OR to drop some not null constraints.
0
 
Melodi RobertsProgrammer/AnalystAuthor Commented:
Thanks.  I will go back to see the generated code to confirm the issue resolution once I have some time.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now