Hibernate mssql dialect [SQLServerException:关键字' user&#39 ;.附近的语法不正确

时间:2017-04-20 17:06:31

标签: java sql-server hibernate jpa jpql

我有以下代码:

@Query("SELECT u FROM User u WHERE u.party.id = :id")
List<User> findUsersByPartyId(@Param("id") Long id);

在日志中我看到:

org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.SQLServer2008Dialect

然后错误:

  com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'user'.

我尝试用[](SELECT u FROM [User]...)包装它但在这种情况下我看到错误:

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: [ near line 1, column 15 [SELECT u FROM [User] u WHERE u.party.id = :id]

如果我无法重命名表格,如何修复它?

0 个答案:

没有答案