Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement;
<p>I am following up this tutorial here
 <a href="http://hellokoding.com/registration-and-login-example-with-spring-xml-configuration-maven-jsp-and-mysql/" rel="nofollow noreferrer">http://hellokoding.com/registration-and-login-example-with-spring-xml-configuration-maven-jsp-and-mysql/</a> 
to create a registration and signup process using spring mvc and maven.
I have created the relationship mapped to user_role between role table and user table. Everything seems to be fine, but when I try to create a new user the application throws error.</p>

<p><strong>User.java</strong></p>

<pre><code>@ManyToMany
    @JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
    public Set&lt;Role&gt; getRoles() {
        return roles;
    }
</code></pre>

<p><strong>Role.java</strong></p>

<pre><code>@ManyToMany(mappedBy = "roles")
    public Set&lt;User&gt; getUsers() {
        return users;
    }
</code></pre>

<p>This is the pictoral representation of the relationship between role table to role_user table and user table to role_user table
<a href="https://i.stack.imgur.com/9w0p7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9w0p7.png" alt="enter image description here"></a></p>

<p>Please why am I getting this error <code>Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement;</code></p>

<p>this is the comlete stacktrace</p>

<pre><code>HTTP Status 500 - Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
</code></pre>

<p>Addition of more stacktrace</p>

<pre><code>root cause
org.hibernate.exception.DataException: could not execute statement
    org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:69)
    org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112)
    org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:211)


root cause

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'password' at row 1
    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3845)
    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
    com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
    com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
    com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
    com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1901)
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2113)
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2049)
    com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2034)
</code></pre>

<p>The above stacktrace occurs when I am trying to create a new user</p>

<p>Please what am I getting wrong? Many thanks</p>