tags:

views:

155

answers:

0

setup: hibernate 3.3, MySQL 5

I have an hibernate entity that have its PK generated using a sequence table. The annotation looks like this:

@GenericGenerator(name = "SCENARIO_TABLE_GEN", strategy = "org.hibernate.id.enhanced.TableGenerator", parameters = {
        @Parameter(name = "initial_value", value = "5"),
        @Parameter(name = "force_table_use", value = "true"),
        @Parameter(name = "table_name", value = "SEQ_TABLE"),
        @Parameter(name = "value_column_name", value = "VALUE_COL"),
        @Parameter(name = "segment_column_name", value = "KEY_COL"),
        @Parameter(name = "segment_value", value = "SCENARIO") })

The problem is, that hibernate generated sequence table (SEQ_TABLE in my case, generated using hbm2ddl) does not have a primary keys.

How do I tell hibernate that I want to have the primary key for the sequence table set on KEY_COL ?