PSQLException: ERROR: syntax error at or near

前端 未结 2 1642
没有蜡笔的小新
没有蜡笔的小新 2021-02-14 03:00

I have what I thought was a straight forward relation in JPA. Looks like this. CompanyGroup:

@Entity
@Table
public class CompanyGroup implements Serializable {

         


        
2条回答
  •  庸人自扰
    2021-02-14 04:03

    Your entity maps across to a table name that is an SQL reserved keyword (User). Sadly for you, your chosen JPA provider does not automatically quote the table name identifier, and so you get exceptions when referring to the table.

    Solution is either to quote the table name yourself in the @Table annotation, or change the table name to not be a reserved keyword. Alternatively use a JPA provider that auto-quotes such reserved keywords for you (e.g DataNucleus)

提交回复
热议问题