问题:
解决:
Article.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
package t3dcool.web2.entity; import io.quarkus.hibernate.orm.panache.PanacheEntity; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import io.quarkus.hibernate.orm.panache.PanacheQuery; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.util.List; import java.util.Objects; @Entity @Table(name = "Article_Article") public class Article extends PanacheEntityBase { @Id @Column(name = "Id") public long id; @Column(name = "Title") public String title; @Column(name = "Star") public byte star; static List<Article> listByLabelId(long labelId, int limit) { PanacheQuery<PanacheEntityBase> q = Article.find(" id in (select articleId from ArticleLabel where labelId = ?1) ", labelId); var q2 = q.page(0, limit); return q2.list(); } } |
参考:
https://quarkus.pro/guides/hibernate-orm-panache.html#定义你的实体entity