我正在使用JPA查询OracleSQL数据库。 不过,我得到的错误:EntityManager查询无法解析属性
Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: CLIENT_ID of: com.fdmgroup.pojo.File [SELECT c FROM com.fdmgroup.pojo.File c WHERE c.CLIENT_ID = :clientId]
当我写了下面的查询
String sqlQuery = "SELECT c FROM XD_FILES c WHERE c.CLIENT_ID = :clientId";
TypedQuery<File> query = em.createQuery(sqlQuery, File.class);
query = query.setParameter("clientId", clientId);
ArrayList<File> clientFiles = (ArrayList<File>) query.getResultList();
文件中有此列
@ManyToOne(targetEntity = Client.class)
@JoinColumn(name = "CLIENT_ID")
private Client client;
我不清楚为什么,因为它似乎有字段“客户端”链接到“CLIEND_ID”。
什么是列名? –
你的“sqlQuery”是SQL,但你使用JPQL的API! –