views:

155

answers:

0

We're running into an issue where we have Event subclasses that use GenerationType.TABLE to generate the primary key, and when we restart the servers we are getting duplicate primary key errors.

We're using SQL Server and Hibernate version 3.5.1-Final.

Here's what our Hibernate annotations look like:

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Event {

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE)
    private long eventID;

we don't specify the allocationSize so we're using the default value. The hibernate sequences table does increment but it seems like on restarts it's reusing already used ID's.