• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Using select strategy (id generated by oracle trigger)

Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My bean id is generated by an oracle sequence which is incremented and affected by a trigger.
I have to specify it in my bean, i see a lot of example on internet, but always with xml files... I'm using annotations..

Here is what i tryed :

I have an unknown property "TAB_ID"

If i disable the oracle trigger and use this following code, it works.. Hibernate will manage the sequence, but that's not what i want..

Since the bean doesn't know the id is managed by oracle, when i do "save(myObj)", the record is correctly inserted, but the id returned is "0" ..
Furthermore, when i use saveOrUpdate(myObj), even if the id already exist (i'm updating an existing record), hibernate will insert a new record instead of updating the existing one...

Could you tell me how to do ?
Thanks a lot !
    Bookmark Topic Watch Topic
  • New Topic