For Oracle you should use GenerationType.SEQUENCE
@Id
@GeneratedValue(generator="MySequence", strategy=GenerationType.SEQUENCE)
@SequenceGenerator(allocationSize=1, name="MySequence", sequenceName="MySequence")
Edit: sequencename updated
Edit: refer to your comment:
Your requirement sounds like composit/embedded id (using multiple columns as primary key) using sequence. but unfortunately both solution doesnt support sequence generator. So far I can say;
*You can create a native query via hibernate and append to index number using 'select mySequence.nextval from dual
.
*Or you can create an oracle view for that with the new column which is showing sequence + index via subquery.
*This one very experimental and I didnt try but you can use @formula annotation. Example here.