I'm creating a Queue
object.
public class Queue {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "queue_number", unique = true, nullable = false, insertable = false, updatable = false)
private Long queueNumber;
...
}
It has the id
field as it's primary key. But as for queueNumber, I want it to auto increment like the id field. The code above just doesn't work. Is there any way to do this?