0

I would like to know how we could use a sequence in JPA. We have a non-pk field which value must come from a sequence in DB. How could I update that value updating the entity?

Thanks in advance.

skaffman
  • 390,936
  • 96
  • 800
  • 764
Pablo Castilla
  • 2,661
  • 2
  • 30
  • 33

1 Answers1

2

JPA defines @GeneratedValue to apply to just PK fields. DataNucleus accepts it on any field. Obviously that is beyond the JPA spec and other implementations may not support such behaviour.

Matt Ball
  • 344,413
  • 96
  • 627
  • 693
DataNucleus
  • 15,319
  • 3
  • 31
  • 37