tags:

views:

105

answers:

1

Hello,

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.

+1  A: 

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.

--Andy (DataNucleus)

DataNucleus