Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get org.hibernate.MappingException: Could not instantiate id generator?

Why do I get

Caused by: org.hibernate.MappingException: Could not instantiate id generator [entity-name=hw11.model.domain.Client]?

Here is class Client here the class in which an error

like image 292
Partizanin Avatar asked Dec 09 '22 00:12

Partizanin


1 Answers

My code was like that:

...
@Id
@Column(name = "ID")
@SequenceGenerator(name = "stu_seq", sequenceName = "STUDENT_SEQ", allocationSize = 10)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "stu_seq")
private int id;
...

I just set the allocationSize as 1 and solved the problem.

like image 108
menoktaokan Avatar answered Mar 12 '23 21:03

menoktaokan