1 Reply Latest reply on Jul 16, 2011 12:39 PM by hernanbolido

    mapping a postgresql array with hibernate

    a10081413

      has anyone successfully mapped a numeric array in postgres to a numeric array in java via hibernate?

      sql:

      CREATE TABLE sal_emp (name text, pay_by_quarter integer[]); 
      INSERT INTO sal_emp VALUES ('one', '{1,2,3}');
      INSERT INTO sal_emp VALUES ('two', '{4,5,6}');
      INSERT INTO sal_emp VALUES ('three', '{2,4,6}');

      mapping:

      <hibernate-mapping> 
         
      <class name="SalEmp" table="sal_emp">
             
      <id name="name" />
             
      <property name="payByQuarter" column="pay_by_quarter" />
         
      </class>
      </hibernate-mapping>

      class:

      public class SalEmp implements Serializable{ 
          private String name
      ;
          private Integer
      [] payByQuarter;
         
      ...// getters & setters
      }

      i get an exception when querying the table.