4
@Entity
public class User {
@Id
@GeneratedValue
private int id;
private String name;
private String email;
private String sex;
private int age;
private Date birthday;
private Date registerdate;
private String login;
private String password;
@ManyToMany
@JoinTable(name = "eventlike_user", joinColumns = @JoinColumn(name = "id_user"), inverseJoinColumns = @JoinColumn(name = "id_eventlike"))
private Collection<Eventlike> eventlikes;
@OneToMany
private Collection<Event> events;
//getters and setters
I get the following error when creating tables:
ERROR: HHH000388: Unsuccessful: create table User (id int8 not null, Birthday timestamp, email varchar(255), login varchar(255), name varchar(255), password varchar(255), registerdate timestamp, sex varchar(255), Primary key (id)) Nov 12, 2014 10:55:33 AM org.hibernate.tool.hbm2ddl.Schemaupdate execute ERROR: ERROR: Error syntax on or near "User" Position: 14
I don’t know what’s making this table not be created but what strikes me is this guy int8
of id
.
I don’t know about the
int8
, but I was intrigued by theERRO: erro de sintaxe em ou próximo a "User" Posição: 14
. You know what this is about?– Math
No manjo mto java, when you have accented characters or capital letters in the fields/tables name in postgres is required to put double quotes in the name. I suggest you put the class name/table name annotation in the low box or the name escaped with double quotes. Something like this:
@table="user"
or@table="\"User\""
.– rray