-1
我使用netbean的選項從數據庫創建實體類,我並不真正習慣於查詢的這個「方言」,我想了解更多關於它的語法。有人能告訴我這個查詢的「方言」或語法的名字是什麼?NamedQueries使用什麼類型的查詢?
@NamedQueries({
@NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u")
, @NamedQuery(name = "Users.findByUserId", query = "SELECT u FROM Users u WHERE u.userId = :userId")
, @NamedQuery(name = "Users.findByName", query = "SELECT u FROM Users u WHERE u.name= :name")
, @NamedQuery(name = "Users.findBySurname", query = "SELECT u FROM Users u WHERE u.surname= :surname")
, @NamedQuery(name = "Users.findByEmail", query = "SELECT u FROM Users u WHERE u.email = :email")
, @NamedQuery(name = "Users.findByDateOfBirth", query = "SELECT u FROM Users u WHERE u.dateob= :dateob")
, @NamedQuery(name = "Users.findByPassword", query = "SELECT u FROM Users u WHERE u.password= :password")})
這就是所謂的JPQL。如果您使用的是JPA,那麼您應該開始閱讀一些關於它的內容。你的班級應該被命名爲User,BTW,而不是Users。 –