Reputation: 216
I have the following entity and their mapping
@Entity
@Table(name = "test")
public class Test implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator", initialValue = 20000)
I want id value begins in 20000 but it doesn't work in postgresql. When the application starts I receive this exception
Caused by: org.hibernate.HibernateException: Multiple references to database sequence [sequence_generator] were encountered attempting to set conflicting values for 'initial value'. Fou nd [20000] and [1]
Do I need a extra configuration to it works?
PS: It is a new database without any previous configuration
Upvotes: 0
Views: 136
Reputation: 78
You could try @TableGenerator annotation. Initial values can be set and seed other values. You can find example and documentation here: Set Initial Value Of Table Generator
Upvotes: 1