Reputation: 22516
i get this error could not get next sequence value
when I try to save this Entity with Hibernate:
package beans;
import javax.persistence.*;
@Entity
@Table(schema = "EVGENY")
public class Article {
@SequenceGenerator(name="ArticleGen", sequenceName="ARTICLESEC")
@Id
@GeneratedValue(generator= "ArticleGen")
private int id;
@Column(name="title")
private String title;
@Column(name="text")
private String text;
@Column(name="postat")
private String postat;
@ManyToOne
@JoinColumn(name = "USER_ID")
private UserAcc user;
public Article(){
}
Get Set...
}
insert into article (title) values('asdfaf');
in Oracle SQL Developer this insert into article (title) values('asdfaf');
works well.
if i set id variable explicitly ( Article a = new Article();a.setId(3);
)
everything is OK. I double checked the name of the sequence.
Upvotes: 1
Views: 11305
Reputation: 109
Check user permissions on the sequence. Most of the time it is grant issue
Upvotes: 1
Reputation: 550
I know a lot of reasons to get this exception. Maybe you can check the questions and give me some more details about your problem:
Upvotes: 0