Column not does not exist
<p>I'm trying to connect two entities but I'm getting an error:</p>

<pre>
Hibernate:
    select
        user0_.id as id1_9_0_,
        user0_.email as email2_9_0_,
        user0_.surname as surname3_9_0_,
        webuser1_.id as id1_11_1_,
        webuser1_.active as active2_11_1_,
        webuser1_.password as password3_11_1_,
        webuser1_.username as username4_11_1_
    from
        user user0_
    left outer join
        web_user webuser1_
            on user0_.id=webuser1_.id
    where
        user0_.id=?
2016-04-12 14:38:26,504 SqlExceptionHelper qtp1239132915-13 [WARN] [] SQL Error: 0, SQLState: 42703
2016-04-12 14:38:26,504 SqlExceptionHelper qtp1239132915-13 [ERROR] [] Error: column user0_.id does not exist
</pre>

<p>And the entity classes I used:</p>

<p>WebUser</p>

<pre><code>@javax.persistence.Entity
@Table(name = "WEB_USER")
public class WebUser implements Entity, Serializable{

private static final long serialVersionUID = 1994758293065748925L;

@Id
@GeneratedValue
public Long id;

@Column(name = "username", nullable = false, unique = true)
public String username;

@Column(name = "password", nullable = false)
public String password;

@Column(name = "active", nullable = false)
public boolean active;

@OneToOne(fetch = FetchType.EAGER, mappedBy = "webUser", cascade = CascadeType.ALL)
public User user;

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}
@Column(length = 200)
public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password =
        Hashing.sha256().hashString(password, Charsets.UTF_8).toString();
}

public boolean isActive() {
    return active;
}

public void setActive(boolean active) {
    this.active = active;
}

public User getUser(){
    return user;
}

public void setUser(User user) {
    this.user = user;
}



@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((id == null) ? 0 : id.hashCode());
    return result;
}

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    WebUser other = (WebUser) obj;
    if (id == null) {
        if (other.id != null)
            return false;
    } else if (!id.equals(other.id))
        return false;
    return true;
}

@Override
public String toString() {
    return "User [id=" + id + ", username=" + username + ", password=" + password
            + ", active=" + active + "]";
}

}
</code></pre>

<p>and User:</p>

<pre><code>@javax.persistence.Entity
@Table(name = "USER")
public class User implements Entity {

@Id
@GeneratedValue
private Long id;

@Column(name = "surname", nullable = false)
public String surname;

@Column(name = "email", nullable = false)
public String email;

@OneToOne
@PrimaryKeyJoinColumn
public WebUser webUser;


public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getSurname() {
    return surname;
}

public void setSurname(String surname) {
    this.surname = surname;
}

public String getEmail(){
    return email;
}

public void setEmail(String email){
    this.email = email;
}

public WebUser getWebUser(){
    return webUser;
}

public void setWebUser(WebUser webUser){
    this.webUser = webUser;
}
}
</code></pre>

<p>What am I doing wrong?</p>

<p>===</p>

<p>I changed an annotation in User class to:</p>

<pre><code>@OneToOne
@JoinColumn(name = "web_user", nullable = false)
public WebUser webUser;
</code></pre>

<p>because hibernate was joining tables with user.id=web_user.id not user.web_user=web_user.id like i wanted.</p>

<p>I still get an error of missing column but diffrent one:</p>

<pre><code>select
    user0_.id as id1_9_1_,
    user0_.email as email2_9_1_,
    user0_.surname as surname3_9_1_,
    user0_.web_user as web_user4_9_1_,
    webuser1_.id as id1_11_0_,
    webuser1_.active as active2_11_0_,
    webuser1_.password as password3_11_0_,
    webuser1_.username as username4_11_0_
from
    user user0_
inner join
    web_user webuser1_
        on user0_.web_user=webuser1_.id
where
    user0_.web_user=?
2016-04-13 09:54:46,131 SqlExceptionHelper qtp673129458-15 [WARN] [] SQL Error: 0, SQLState: 42703
2016-04-13 09:54:46,131 SqlExceptionHelper qtp673129458-15 [ERROR] [] ERROR: column user0_.web_user does not exist
</code></pre>