PSQLException: ERROR: syntax error at or near
<p>I have what I thought was a straight forward relation in JPA. Looks like this. CompanyGroup:</p>

<pre><code>@Entity
@Table
public class CompanyGroup implements Serializable {


    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    private Long id;
    @Column(name = "name")
    private String name;
    @JoinColumn(name = "companies")
    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    private List&lt;Company&gt; companies;
}
</code></pre>

<p>Company:</p>

<pre><code>@Entity
@Table
public class Company implements Serializable {
    private static final long serialVersionUID = 1L;

    @Column(name = "name")
    private String name;
    @JoinColumn(name = "users")
    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    private List&lt;User&gt; users;

    @Id
    @GeneratedValue
    private Long id;
}
</code></pre>

<p>User:</p>

<pre><code>@Entity
@Table
public class User {

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


    @Id
    @GeneratedValue
    private Long id;
}
</code></pre>

<p>I have omitted setters, getters, etc.</p>

<p>This is not working. I'm trying to save a CompanyGroup(Has 2 companies, each company has 2 users, all entities are unique) to a fully empty database. </p>

<p>I persist this using Spring-Data, accessed in a service like this:</p>

<pre><code>@Service
public class ConcreteCompanyGroupService implements CompanyGroupService {

    @Autowired
    private CompanyGroupRepository repository;
    @Transactional
    @Override
    public void save(CompanyGroup group) {
        repository.save(Collections.singleton(group));
    }
}
</code></pre>

<p>When I try to call this method I receive this:</p>

<pre><code> org.postgresql.util.PSQLException: ERROR: syntax error at or near "User"
  Position: 13
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2458)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2158)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:291)
</code></pre>

<p>Hopefully I have done something stupid that someone can find quickly. I don't know how to solve this.</p>

<p>EDIT:</p>

<p>The driver in my pom.xml:</p>

<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
    &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
    &lt;version&gt;9.4.1211&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>