I would like to make a unique field "number" with autogeneration(autoincrement, last number + 1). But it is not an id field. How can i reach that? @GeneratedValue doesn't work. Only id was generated. My code doens't work.
My entity
@Entity
@Table(schema = "public")
public class Policeman implements Serializable {
@Id
@GeneratedValue
private Long id;
@Column
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long number;
@Column
private String fam;
@Column
private String name;
@Column
private String otch;
//setters getters
}