我有一个 Maven 项目,我想使用 JPA。
我的 pom.xml 是
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
</dependency>
</dependencies>
我有以下课程
package edu.javacd.reviewservice;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@Entity
@Table(name = "REVIEW")
@NamedQueries({ @NamedQuery(name = "Review.findAll", query = "SELECT r FROM Review r"),
@NamedQuery(name = "Review.findById", query = "SELECT r FROM Review r WHERE r.id = :id"),
@NamedQuery(name = "Review.findByMovieId", query = "SELECT r FROM Review r WHERE r.movieId = :id") })
public class Review implements Serializable {
}
我如何配置 pom.xml 以使用注释 @NamedQueries
倚天杖
holdtom
相关分类