Error: java.sql.SQLDataException,Invalid character string format for type int. I really don't understand?
<p>I have a problem with my project. When i browse <code>http://localhost:8080/user/form</code> to fill information user  </p>

<p><a href="https://i.stack.imgur.com/oQD9x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oQD9x.png" alt="enter image description here"></a></p>

<p>Then submit form to save user and automaticlly direct <code>http://localhost:8080/user/list</code> to display list User, but occur following error:</p>

<blockquote>
  <p>Hibernate: insert into userdat (age, birthday, gender, password,
  username) value s (?, ?, ?, ?, ?) Mar 27, 2016 8:30:17 AM
  org.hibernate.engine.jdbc.spi.SqlExceptionHelper$Standar
  dWarningHandler logWarning WARN: SQL Warning Code: 10000, SQLState:
  01J01 Mar 27, 2016 8:30:17 AM
  org.hibernate.engine.jdbc.spi.SqlExceptionHelper$Standar
  dWarningHandler logWarning WARN: Database 'D:\PROJECTSPRING\userdb'
  not created, connection made to existin g database instead. Mar 27,
  2016 8:30:17 AM
  org.hibernate.hql.internal.QueryTranslatorFactoryInitiat or
  initiateService INFO: HHH000397: Using ASTQueryTranslatorFactory
  Hibernate: select user0_.username as username1_0_, user0_.age as
  age2_0_, user0_ .birthday as birthday3_0_, user0_.gender as
  gender4_0_, user0_.password as passw ord5_0_ from userdat user0_ Mar
  27, 2016 8:30:17 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper
  logExce ptions WARN: SQL Error: 20000, SQLState: 22018 Mar 27, 2016
  8:30:17 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExce
  ptions ERROR: Invalid character string format for type int. [WARNING]
  org.springframework.web.util.NestedServletException: Request
  processing failed; nested exception is
  org.hibernate.exception.DataException: could not execute que ry</p>
  
  <p>Caused by: org.hibernate.exception.DataException: could not execute
  query
          at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQL
  ExceptionTypeDelegate.java:52)
          at org.hibernate.exception.internal.StandardSQLExceptionConverter.conver
  t(StandardSQLExceptionConverter.java:42)
          at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlException
  Helper.java:111)</p>
  
  <p>Caused by: java.sql.SQLDataException: Invalid character string format
  for type i nt.
          at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknow
  n Source)
          at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source
  )
          at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException
  (Unknown Source)</p>
</blockquote>

<p><strong>Here file UserDaoImpl.java</strong></p>

<pre><code>@Repository
public class UserDaoImpl implements UserDao{
    @Autowired
    public LocalSessionFactoryBean sessionFactory;


    @Override
    public void save(User user) {
        // TODO Auto-generated method stub
        Session session = sessionFactory.getObject().openSession();
        session.save(user);
        session.flush();
        session.close();

    }

    @Override
    public void update(User user) {
        // TODO Auto-generated method stub

    }

    @Override
    public List&lt;User&gt; listUsers() {
        // TODO Auto-generated method stub
        Session session = sessionFactory.getObject().openSession();
        Query query = session.createQuery("from User");
        return (List&lt;User&gt;)query.list();
    }
</code></pre>

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

<pre><code>@Entity
@Table(name = "userdat",uniqueConstraints={@UniqueConstraint(columnNames="username")})
public class User {
    @Column(name = "gender", nullable = false)

    public Gender getGender() {
        return gender;
    }
    public void setGender(Gender gender) {
        this.gender = gender;
    }
    @Id
    @Column(name = "username", unique = true, nullable = false)
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    @Column(name = "password", nullable = false)
    public String getPassWord() {
        return passWord;
    }
    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }
    @Column(name = "birthday", nullable = false)
    public Date getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(Date birthDay) {
        this.birthDay = birthDay;
    }
    @Column(name="age", nullable = false)
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
    private String userName;
    private String passWord;
    private Date birthDay;
    private Integer age;
    private Gender gender;


}
</code></pre>

<p>Here file Gender.java</p>

<pre><code>public enum Gender {
    MALE("Male"),
    FEMALE("Female"),
    OTHER("Other");
    private String name;

    private Gender(String name) {
        this.name = name;
    }

    public String getGender(){
        return this.name;
    }
        }
</code></pre>

<p><strong>Here Create Table in DB</strong></p>

<pre><code>public void createTable() throws SQLException{
        try {
            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
            Connection connection = DriverManager.getConnection("jdbc:derby:D:/PROJECTSPRING/dbuser;create=true");
            createTableNotExist(connection,"userdat", "create table userdat"
                    + "(username varchar(1000) primary key,"
                    + "password varchar(1000),birthday date,"
                    + "age integer,gender varchar(100))");
//          createTableNotExist(connection,"subject","create table subject"
//                  + "(id bigint primary key generated always as identity(start with 1,increment by 1),"
//                  + "title varchar(1000),student integer,score integer)" );
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
</code></pre>