Grails: getting "Field XXX doesn't have a default value"
<p>I'm having a weird error caused by a many-to-many relationship between two domain classes.  The classes are below.  When I try to save the NoteParagraph object, I DON'T immediately get an error:  </p>

<pre><code>NoteParagraph np = new NoteParagraph(number: noteNumber, content: noteText)
note.addToChildParagraphs(np).save()
</code></pre>

<p>However, on the next .save() action (on an unrelated object), I get the following error stacktrace:</p>

<pre><code>Field 'note_paragraph_id' doesn't have a default value. Stacktrace follows:
java.sql.SQLException: Field 'note_paragraph_id' doesn't have a default value
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1901)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2113)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2049)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2034)
at org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2.doCall(GormStaticApi.groovy:102)
</code></pre>

<p>Here are my classes:</p>

<pre><code>class NoteParagraph {

    String number
    String content
    Note parentNote

    Date dateCreated
    Date lastUpdated

    static belongsTo = Note

    static hasMany = [
        childNotes: Note
    ]

    static constraints = {
    }

    static mapping = {
        content type:'text'
    }
}
</code></pre>

<p>and the second one: </p>

<pre><code>class Note {

    Integer noteType
    Integer parentType
    Integer parentId
    String heading

    Date dateCreated
    Date lastUpdated

    static hasMany = [
        childParagraphs: NoteParagraph
    ]

    static constraints = {

    }

    static mapping = {
        heading type:'text'
    }
}
</code></pre>

<p>I've tried deleting and recreating my database as some other threads have suggested, and that did not help.</p>