The oracle-hibernate combination is driving me crazy now.
I have one pojo class (MyTable) and corresponding hbm file (my_table.hbm.xml).
Now I want to make insert into table "my_table".
I want oracle sequence to be used for entry into primary key of this table.
So I updated in my hbm file (my_table.hb,.xml)
Code:
<id name="id" type="big_decimal">
            <column name="id" />
            <generator class="sequence">
                 <param name="sequence">MY_TABLE_ID_SEQ</param>
           </generator>
</id>
The data type used for numbers in oracle is getting mapped to java.maths.BigDecimal.
So in MyTable class I have following entry
Code:
       private BigDecimal id;
      public BigDecimal getId() {
      return this.id;
   }
   public void setId(BigDecimal id) {
      this.id = id;
   }
Now I get error "org.springframework.orm.hibernate3.HibernateSystemException: this id generator generates long, integer, short or string; nested exception is"
As per topic https://forum.hibernate.org/viewtopic.php?f=1&t=985008
I manually change hbm file to
Code:
<id name="id" type="long">
            <column name="id" />
            <generator class="sequence">
                 <param name="sequence">MY_TABLE_ID_SEQ</param>
           </generator>
</id>
 And corresponding MyTable class methods to 
Code:
 private long id;
      public long getId() {
      return this.id;
   }
   public void setId(long id) {
      this.id = id;
   }
But now I get error: 
org.springframework.orm.hibernate3.HibernateSystemException: Provided id of the wrong type. Expected: class java.lang.Long, got class java.math.BigDecimal; nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Long, got class java.math.BigDecimal
Has anyone got similar issue? Please kindly reply. 
Thank is advance.