我可以在hibernate上写自定义主键索引名吗?
例如,
我有这样的实体:
@Entity
public class Person{
@Id
@GeneratedValue(generator = "SWIFT_JOPT_SEQ", strategy = GenerationType.SEQUENCE)
@SequenceGenerator(name = "SWIFT_JOPT_SEQ", allocationSize = 1, sequenceName = "SWIFT_JOPT_SEQ", schema = "swift")
@Column(name = "id")
private long id;
}
hibernate生成索引名{table}u pkey
当我像这样声明索引时
@Table(name = "person", schema = "swift", indexes = {
@Index(columnList = "id", name = "idx_p_id", unique = true) })
hibernate不重写主键索引名并创建新索引。