Hibernate 允许您只说“.id”。假设我有:
@Entity public class Customer {
@Id private Integer customerId;
@Basic private String customerName;
// getters and setters
}
我想通过 ID 获取客户的姓名:
SELECT cust.customerName FROM Customer cust WHERE cust.id = :customerId
请注意,我将“id”而不是“customerId”作为快捷方式。这是有效的 JPQL,还是仅在 Hibernate 中有效?