title: Hibernate Throwing Max Size Attribute Is Mandatory Exception
body: <p>I'm just getting started trying to use Hibernate to create a PostgreSQL database but keep getting this exception:</p>
  
  <pre><code>org.hibernate.HibernateException: java.lang.IllegalArgumentException: max size attribute is mandatory
  </code></pre>
  
  <p>It happens when I run my main method on the line where I try to build a session factory but I can't find anything about this exception anywhere online.  I'm wondering anyone has any ideas on what could be causing this.</p>
  
  <p>Main Class:</p>
  
  <pre><code>package com.package.ingestor;
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  
  public class HibernateTest {
  
      public static void main(String[] args){
          Student user = new Student();
          user.setStudentId(1);
          user.setStudentName("Bri Guy");
          user.setStudentAge(32);
  
          SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
          Session session = sessionFactory.openSession();
          session.beginTransaction();
          session.save(user);
          session.getTransaction().commit();
      }
  }
  </code></pre>
  
  <p>Hibernate Object:</p>
  
  <pre><code>package com.bossanova.ingestor;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import javax.persistence.UniqueConstraint;
  
  @Entity
  @Table(name = "student", uniqueConstraints={@UniqueConstraint(columnNames={"id"})})
  public class Student {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "id", length=11, nullable=false, unique=true)
      private Integer studentId;
  
      @Column(name = "name", length=20, nullable=true)
      private String studentName;
  
      @Column(name="age", length=5, nullable=true)
      private Integer studentAge;
  
      public Student() { }
  
      public Student(Integer studId, String studName, Integer studAge) {
          this.studentId = studId;
          this.studentName = studName;
          this.studentAge = studAge;
      }
  
      public Integer getStudentId() {
          return studentId;
      }
  
      public void setStudentId(Integer studentId) {
          this.studentId = studentId;
      }
  
      public String getStudentName() {
          return studentName;
      }
  
      public void setStudentName(String studentName) {
          this.studentName = studentName;
      }
  
      public Integer getStudentAge() {
          return studentAge;
      }
  
      public void setStudentAge(Integer studentAge) {
          this.studentAge = studentAge;
      }
  
      @Override
      public String toString() {
          return "Student= Id: " + this.studentId + ", Name: " + this.studentName + ", Age: " + this.studentAge;
      }
  }
  </code></pre>
  
  <p>Config file:</p>
  
  <pre><code>&lt;!DOCTYPE hibernate-configuration SYSTEM
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;!-- Database connection settings --&gt;
          &lt;property name="connection.driver_class"&gt;org.postgresql.Driver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:postgresql://localhost:5433/hibernatedb&lt;/property&gt;
          &lt;property name="connection.username"&gt;postgres&lt;/property&gt;
          &lt;property name="connection.password"&gt;password&lt;/property&gt;
  
          &lt;!-- JDBC connection pool (use the built-in) --&gt;
          &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  
          &lt;!-- SQL dialect --&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQL95Dialect&lt;/property&gt;
  
          &lt;!-- Enable Hibernate's automatic session context management --&gt;
          &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
  
          &lt;!-- Disable the second-level cache  --&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.internal.NoCacheProvider&lt;/property&gt;
  
          &lt;!-- Echo all executed SQL to stdout --&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
  
          &lt;!-- Drop and re-create the database schema on startup --&gt;
          &lt;property name="hbm2ddl.auto"&gt;create&lt;/property&gt;
          &lt;mapping class="com.bossanova.ingestor.Student"/&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>