views:

289

answers:

1

I use the Eclipse Hibernate Tools to create domain classes with JPA annotations from my Oracle database. To control sequence generation I have added the following entry to the hibernate.reveng.xml:

...
<primary-key>
<generator class="sequence">
<param name="sequence">SEQ_FOO_ID</param>
</generator>
</primary-key>
...

This results in the following annotation:

@SequenceGenerator(name = "generator", sequenceName = "SEQ_FOO_ID")

However I need to set the "allocationSize" like this:

@SequenceGenerator(name = "generator", sequenceName = "SEQ_FOO_ID", allocationSize = 1)

Is it possible to set this somehow in the hibernate.reveng.xml?

A: 

Yes, you can. You have to rewrite the strategy of the reveng class.

There is document in Hibernate help center.