Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using sequence in case of Composite key

 
Nidhi Singhal
Ranch Hand
Posts: 89
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using hibernate and have a composite key in my table (made up of 3 coloumns). I want to use a sequence to generate values for one of the coloumn (which is a part of the composite key).

I am using the following way, but it's not working.

@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="remitBchThresholdSeqNbr_SEQ")
@SequenceGenerator(name = "remitBchThresholdSeqNbr_SEQ", sequenceName="remitBchThresholdSeqNbr_SEQ")
@Column(name = "REMIT_BCH_THRESHOLD_SEQ_NBR", nullable = false, precision = 15, scale = 0)
public long getRemitBchThresholdSeqNbr() {
return this.remitBchThresholdSeqNbr;
}

Can anyone tell me that what is it that I am doing wrong here and how can I get this working.

Thanks,
Nidhi
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a sequence, why use a composite key?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic