``` {code:java} @Entity @Table(name = "EVNT_MILSTN") @IdClass(EventMilestonePK.class) public class EventMilestone { @Id @Column(name = "EVNT_ID") private Long eventId; @Id @Column(name = "EVNT_MILSTN_ID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long eventMilestoneId; } {code} ``` When using create-drop, the table generated puts the generated value on the wrong column: ` {{ create table evnt_milstn (evnt_id bigint generated by default as identity, evnt_milstn_id bigint not null ` }}
The problem appears in ` {{ org.hibernate.tool.schema.internal.StandardTableExporter ` }} in ` {{ getSqlCreateStrings ` }}
This code: ``` {code:java} // Try to find out the name of the primary key in case the dialect needs it to create an identity String pkColName = null; if ( table.hasPrimaryKey() ) { Column pkColumn = (Column) table.getPrimaryKey().getColumns().iterator().next(); pkColName = pkColumn.getQuotedName( dialect ); } {code} ``` is not looking for the GeneratedValue identity column but merely the first primary key column.
*This should be getting the column with @GeneratedValue* |
|