Hibernate 5 更改为不使用仅获取第一行 [英] Hibernate 5 change not to use fetch first rows only

查看:17
本文介绍了Hibernate 5 更改为不使用仅获取第一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Hibernate 5.2 与 oracle 11 一起使用,它不支持仅获取第一行,我需要回到旧样式的休眠状态.是否有任何休眠配置可以做到这一点?

I'm using Hibernate 5.2 with oracle 11 which does not support fetch first rows only and I need to get back to old style hibernate. is there any hibernate configuration to do that ?

推荐答案

您可以强制 Hibernate 使用 Oracle 10g 方言,这样您将使用 rownum 而不是先获取旧限制规则.

You can force Hibernate to use the Oracle 10g dialect, this way you will get the old limit rule with rownum instead of fetch first.

查看 官方文档,您可以使用此属性强制使用方言:

Looking at the official documentation, you can force the dialect with this property:

hibernate.dialect=org.hibernate.dialect.Oracle10gDialect

或者,如果您使用带有 JPA 的 Spring Boot 2,您可以这样设置:

Or, if you are using Spring Boot 2 with JPA, you can set this way:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect

最好的问候.

这篇关于Hibernate 5 更改为不使用仅获取第一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆