• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate save Oracle Number

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having issues with Hibernate save. I wanted the newly created primary key so I had saved the object but it gives me a class cast exception. Persist works just fine.

Employee e = sessionFactory.getCurrentSession().save does not work
sessionFactory.getCurrentSession().persist works

java.lang.ClassCastException: java.lang.Long incompatible with com.test.Employee
java.math.BigDecimal incompatible with com.test.Employee -- If I change it to BigDecimal

Oracle column - "ID" NUMBER(36 , 0) NOT NULL

@Id
@GeneratedValue(generator = "testKey")
@SequenceGenerator(name = "testKey", sequenceName = "ID_SEQ")
@Column(name = "ID")
private Long id;

Should I be using something other than Long
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic