我正在使用netbean的选项从数据库创建实体类,我不习惯这个“方言”查询,我想了解更多关于它的语法。有人能告诉我这个查询的“方言”或语法的名称是什么?
@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")})
答案 0 :(得分:1)
它不是SQL,它是JPQL(Java持久性查询语言),它是在JPA(Java Persistence API)规范中定义的。
JPA的实现(例如Hibernate)将使用正确的SQL方言将其转换为SQL查询,以获取他们正在访问的数据源。