Tony
Tony

Reputation: 3805

Hibernate ERROR: missing FROM-clause entry

This is my entity class:

@Entity
@Table(name = "authdata")
public class AuthData  {


    @Id
    @Column(name = "login")
    private String login;

    @Column(name = "password")
    private String password;

    @Column(name = "email;")
    private String email;

    public AuthData() {

    }

This is my DAO:

@Override
public AuthData get() {
    return (AuthData) sessionFactory.getCurrentSession()
            .createQuery("from AuthData").uniqueResult();
}

This will happen, if I run get() method:

org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "authdata0_"

What is wrong? authdata table exists.

Upvotes: 0

Views: 2154

Answers (1)

akakus
akakus

Reputation: 191

The problem is you have got following column declaration:

@Column(name = "email;")
private String email;

This adds ';' to the SQL query effectively making it unusable. Remove the semicolon from the column name and you will be all right!

Upvotes: 1

Related Questions