I have got a strange problem, the method session.save() is throwing syntax exception "org.postgresql.util.PSQLException: ERROR: syntax error at or near "user"" -look at the picture attached where you can see mapped table, hibernate query and it's parameters, all looks right, I have no idea where the problem can be. The column id_user has sequence which is autogenerated, and this value of the sequence is increases every time i try to call the save() method. The User mapped class:
package com.wily.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name="user")
@SequenceGenerator(sequenceName="user_id_user_seq", name="userSequence")
public class User {
@Id
@Column(name="id_user")
@GeneratedValue(generator="userSequence")
private int id;
@Column(name="username")
private String username;
@Column(name="password")
private String password;
@Column(name="email")
private String email;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
So, the sequence is increasing, but user is not saved, the image: