小编Din*_*esh的帖子

休眠中的外卡字符

如何在hibernate中添加通配符?

我试着这样做,但已经有错误

"来自员工,其中epf像"+ Epf +"%";

Epf是传递给查询的int参数

hibernate

3
推荐指数
1
解决办法
9136
查看次数

在休眠中创建内部查询

如何在 hibernate 的内部查询中添加 setparameter() 方法?

我尝试这样做但已经有错误

这是我的代码

Query query=session.createQuery("select eq.euipmentName,eq.type from Euipment eq where eq.id in(select euipment from Quotation qt where qt. supQuotation=:ids)");          
query.setParameter("ids",id);
list = (List<Euipment>)query.list();
Run Code Online (Sandbox Code Playgroud)

java hibernate

3
推荐指数
1
解决办法
2万
查看次数

对于大量数据使用像 JSON_EXTRACT 这样的 SQL 函数是否合适

我正在实现一个数据库,每天将处理超过2000 条记录,我将使用SQL函数(例如Mysql JSON_EXTRACTORACLE JSON_VALUE )来获取数据。因为。我将数据存储在 JSON 列中。

我将使用Mysql JSON_EXTRACTORACLE JSON_VALUE 函数来搜索数据范围,如下所示

SELECT *
FROM audit
where json_extract(detail_x,'$.eventDt') > '2017-10-01 00:00:00'
  And json_extract(detail,'$.eventDt')   < '2018-11-01 00:00:00'
Run Code Online (Sandbox Code Playgroud)

最大日期范围为30 天。因此,最大行数约为 2000 * 30 = 60000

我的问题是。对于这种情况,可以使用Mysql JSON_EXTRACTORACLE JSON_VALUESQL函数吗?

开放讨论。谢谢。

mysql sql database oracle database-performance

3
推荐指数
1
解决办法
4583
查看次数

如何使用EntityManager为MySql JSON_EXTRACT函数创建JPQL查询

我有 mysql 表,有一列使用json 数据类型我想使用JPQL来执行以列作为条件的查询,我可以使用 EntityManager 像下面这样编写它。

它完全适用于以下(选择所有产品)

 Query query = em.createQuery("select o from Product o"); 
Run Code Online (Sandbox Code Playgroud)

并且不适用于 json_extract 函数 + 实体管理器

 Query query = em.createQuery("select o from Product o where json_extract(o.des,'$.org') = 'ABC'");
Run Code Online (Sandbox Code Playgroud)

这对我来说完全不起作用并返回以下错误

java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Syntax error parsing [select o from Product o where json_extract(o.des,'$.org') = 'ABC']. 
[41, 85] The expression is not a valid conditional expression.

Caused by: org.eclipse.persistence.exceptions.JPQLException: 
Exception Description: Syntax error parsing [select …
Run Code Online (Sandbox Code Playgroud)

mysql jpa jpql spring-data spring-data-jpa

2
推荐指数
1
解决办法
4860
查看次数