My Application uses as underline database Oracle or SQLServer depending on our customer demand.
In Oracle I use SEQUENCE for ID generation and for SQLServer I use IDENTITY.
In order to support this I am using the
GenerationType.AUTO , however, when doing so when working with Oracle the seqhilo does not work (it does work only when using
GenerationType.SEQUENCE). I even tried to add 'allocationSize' but it did not help.
Code:
@Id
@GeneratedValue(strategy=GenerationType.AUTO, generator="XX")
@SequenceGenerator(name="XX", sequenceName="SEQ_AS_TEST", allocationSize=20 /* works only if generation type is sequence*/)
@Column(name = "ID", unique = true, nullable = false)
public int getId() {
return this.id;
}
- Does the seqhilo works only with GenerationType.SEQUENCE ?
- Is there any way to force seqhilo usage with GenerationType.AUTO?
I am using:
- Hibernate, Hibernate EntityManager, Annotations - 3.2.5.
- Oracle 10
- SQLServer 2005
Thanks,
Ronen