我的实体类
@Entity
class MasterStccycode{
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 3)
@Column(name = "CODE")
private String code;
@Size(max = 100)
@Column(name = "DESC")
private String desc;
}
我的 JPA 查询
SELECT t.code, t.desc FROM MasterStccycode t
然后我有以下异常
异常 [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
内部异常:com.microsoft.sqlserver.jdbc.SQLServerException:关键字“DESC”附近的语法不正确。
错误代码:156
调用:SELECT CODE, DESC FROM master_stccycode 查询:ReportQuery(referenceClass=MasterStccycode sql="SELECT CODE, DESC FROM master_stccycode")
我知道解决方案是用into包装DESC
关键字,但我怎样才能在 JPA QL 上做到这一点?[]
[DESC]