title: PostgreSQL to Java Data Types (Grails)
body: <p>I have the following (Grails) domain object:</p>
  
  <pre><code>class Country {
  
  Integer id
  char country_abbr
  String country_name
  
  static mapping = {
      version false
      id name: 'id'
      table 'country'
      id generator:'identity', column:'id'
  }
  
  static constraints = {
  }}
  </code></pre>
  
  <p>The <strong>'country_abbr'</strong> field within the <strong>'country table'</strong> has type: <strong>character(2)</strong>. However, whenever I am setting the domain object's data type (for <strong>'country_abbr'</strong>) to <strong>String</strong>, initialization is failing with the following exception</p>
  
  <pre><code> org.hibernate.HibernateException: Wrong column type in mydb.country for column country_abbr. Found: bpchar, expected: varchar(255)
  </code></pre>
  
  <p>On the other hand, leaving this type as a Java <strong>char</strong> would only retrieve the first character. Any ideas how may I map to this type? Also, what is bpchar exactly?</p>
  
  <p>Thanks</p>