我有这个映射:
@Entity
public class Agenda implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@Id
@ManyToOne
private PessoaFisica pessoaFisica;
@Id
@ManyToOne
private Preferencia preferencia;
}
女巫生成这张表:
create table agenda (
id bigint not null,
preferencia_id bigint not null auto_increment,
pessoa_fisica_id bigint not null,
primary key (preferencia_id, pessoa_fisica_id, id)
);
我以前使用过多个@id,但这是我第一次需要自动增量字段。为什么自动增量被放错了位置?