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
  • 398,947
  • 96
  • 818
  • 769
Pablo Castilla
  • 2,723
  • 2
  • 28
  • 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
  • 354,903
  • 100
  • 647
  • 710
DataNucleus
  • 15,497
  • 3
  • 32
  • 37