Reputation: 560
to create a sequence on JPA I normaly use this @GeneratedValue(strategy=GenerationType.AUTO) @SequenceGenerator(name="example_sequence", sequenceName="example_sequence")
But I want to create a sequence that is also generated automatically but it increments from 0 to 255 and when this value is acheived it restarts from zero
Upvotes: 0
Views: 127
Reputation: 12296
you will need to create your own sequence generator
http://www.objectdb.com/api/java/jpa/SequenceGenerator
http://openjpa.apache.org/builds/1.1.0/docs/jpa_overview_mapping_sequence.html
http://blog.cyclopsgroup.org/2007/04/custom-idgenerator-for-jpa-gap-between.html
Upvotes: 3