Friday, 13 September 2013

Java - Openjpa: how to specify sequence generator starting from hibernate hbm

Java - Openjpa: how to specify sequence generator starting from hibernate hbm

I've to switch persistence of a project using HIBERNATE to OPENJPA and I
started from entities and hbm files which define type of columns, etc.
I've an Id on hibernate generated in that way:
<id name="id" type="java.lang.Integer">
<column name="id"/>
<generator class="sequence">
<param name="sequence">seq_illness</param>
</generator>
</id>
how can I "translate" it ointo Jpa annotation to my entity class, in
particular how can I represent sequence generator? I'm new to this feature
and I don't understand well usage of
@GeneratedValue(strategy = GenerationType.SEQUENCE)
how can I reproduce sequence parameter and define the correct sequence
generator?

No comments:

Post a Comment