jpql « Property « JPA Q&A

1. Can I refer to the primary key of any entity in JPQL by the name "id", regardless of the entity's ID property name?

Hibernate allows you to just say ".id". Let's say I have:

@Entity public class Customer {
  @Id private Integer customerId;
  @Basic private String customerName;
  // getters and setters
And ...

2. In JPQL, how do you access properties of named parameters?

I'm using Hibernate 3.5.4-Final. I want to pass an entity as a parameter of a named query, and then access a persisted property of that named parameter in that query. I want ...