• 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

How to represent a sequence in oracle in HQL

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a table with composite key. In that one field in the composite key must be sequence generated. Is there any way of representing a sequence table in oracle in HQL?? I have a sequence in my oracle database called Concurrent. Now, i would like to know how can i get the value from the Concurrent sequence and map to the part of my composite key.

Please do inform regarding this

thanks in advance..
Venkat Dasari
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can map a sequence as a key generation strategy like this:

You would use this as your primary key for which ever object you are mapping. Hibernate doesn't give you a way to map this id as part of a composite id. Why? Well I would guess its because there is no valid reason for doing this. Composite ids tend to get used to create a natural key for an entity which doesn't really have one instead of using a synthetic key. The only purpose of a sequence in this context is to generate a synthetic key. If you already have a quarenteed non-null, unique, unchanging value in your composite key, what part do the other members of the key play?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic