问题标签 [criteriaquery]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
1152 浏览

sql - 通过 CriteriaQuery 通过子查询从父项中选择一个子项

有谁知道我如何使用子查询通过 CriteriaQuery 从 ProductCategory 返回不同的产品数组!我尝试了这些教程,但没有奏效:

带有 CriteriaQuery 的 where 子句中的子查询

}

这是实体

}

}

0 投票
1 回答
2408 浏览

jpa - 集合的 CriteriaBuilder 和 CriteriaQuery 之间的区别

有什么区别:

  • 标准Builder.in(谓词);
  • 条件查询.where(谓词);

这似乎给出了相同的结果。我错过了什么吗?我们应该选择查询上方的构建器吗?

完整示例:

0 投票
1 回答
1285 浏览

java - JPA: Find all articles that have a common set of tags

I have the following entities:

How can I efficiently find all Article entities that have a common set of tags?

The naive approach is to find all the articles that belong to each tag and then return the intersection of all the article sets. Something like:

My question is "Is there more efficient way of doing this, that does not require to fetch possibly all the articles from the DB, like this one ? Maybe through a JPQL query or using the CriteriaBuilder (I've never used it before)"

0 投票
1 回答
869 浏览

java - 如何在 CriteriaQuery 中使用 jpa 设置模板的位置

我是 java EE 的初学者,我需要知道如何此标准代码中设置分句

他们会注意到我在 java ( <T>) 中使用模板来使此代码与我的数据库中的各种实体一起工作。

然后我传递 sql(在 postgresql 中)代码和实体类。

SQL:

和类实体

我需要知道的是如何使用方法模板在函数findEntity的代码中添加 where 子句。

条件的 where 子句应该匹配列_Enable,这个列提到的这个列在我的数据库的 4 个表中重复,所以你注意到最好在那个函数中重用代码。

谢谢

0 投票
1 回答
467 浏览

java - CriteriaQuery 抽象类列表

我有订单、文章、汽车等课程

如何使用条件查询检查汽车的文章?

0 投票
3 回答
2376 浏览

java - 向 CriteriaQuery 添加 SQL 条件

我需要向 CriteriaQuery 添加类似 Restrictions.sqlRestriction 的内容。如何将 SQL 条件添加到 CriteriaQuery?

我的代码:

0 投票
2 回答
2505 浏览

hibernate - 如何编写与集合完全匹配的 JPA 条件查询?

我正在使用 JPA 2.0 和 Hibernate 4.1.0.Final。我有几个课程,Groups 和 GroupMembers。每个 GroupMember 都绑定到一个用户对象

是否可以编写一个 JPA 条件查询,给定用户对象的 java.util.Set,将返回其成员与该 Set 完全匹配的组?我尝试了以下...</p>

但它失败了,但有一个例外……</p>

0 投票
0 回答
156 浏览

jpa - JPA 保存 CriteriaQuery

创建 JPA CriteriaQuery 后,我们需要保留它,以便以后可以细化搜索或进行分页。在 hibernate 中,我们使用了与 EntityManager 无关的 DetachedCriteria。但是 JPA CriteriaQuery 是从 EntityManager 创建的。CriteriaQuery 的实现可能无法序列化,具体取决于 JPA 提供程序。有没有办法在没有附加 EntityManager 的情况下保存 CriteriaQuery?谢谢。

0 投票
2 回答
650 浏览

grails - grails服务函数的返回类型是什么?

我有这样的 grails 服务功能

但是我对这个函数的返回类型有点困惑,目前的实现它正在工作,但我知道它是错误的返回类型。

请建议,提前谢谢。

0 投票
1 回答
4432 浏览

jpa - 条件查询 JPA:插入选择

是否可以使用 CriteriaQuery (EclipseLink) 执行以下 SQL 查询?

INSERT INTO my_table(从 other_table 中选择列)