GenerationType.AUTO与hibernate中的GenerationType.IDENTITY [英] GenerationType.AUTO vs GenerationType.IDENTITY in hibernate

查看:1085
本文介绍了GenerationType.AUTO与hibernate中的GenerationType.IDENTITY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我们使用mysql作为数据库,我们使用

Currently we are using mysql as a database and we use

@Generated Value(strategy = GenerationType.IDENTITY)

在某些情况下我们需要将我们的数据库迁移到Oracle,因为它无法正常工作。如果有人知道这背后存在的实际差异是什么它是如何工作的?

It's working perfectly at certain situation we need to migrate our database to Oracle at that time it's not working properly.If any one knows what's actual difference present behind this and how it's working?

推荐答案

它怎么能正常工作(你没有像你的意思那样定义基本信息)与Oracle?我没有看到 AUTO 与您的问题的相关性 - 只是让实现选择它想要使用的内容。

How could it "work properly" (you don't define basic info like what you mean by that) with Oracle ? I don't see the relevance of AUTO to your question - that simply lets an implementation choose what it wants to use.

IDENTITY (根据JPA javadocs和spec - 你应该指的是什么)意味着自动增量。在Oracle中没有这样的概念,但在MySQL,SQLServer和其他一些概念中。我希望任何体面的JPA实现都会在尝试这样的事情时标记错误。

"IDENTITY" (as per JPA javadocs and spec - what you should be referring to) means autoincrement. There is no such concept in Oracle, yet there is in MySQL, SQLServer and a few others. I would expect any decent JPA implementation to flag an error when even trying such a thing.

Oracle允许 SEQUENCE TABLE 但要使用的策略

Oracle would allow "SEQUENCE", or "TABLE" strategies to be used however

这篇关于GenerationType.AUTO与hibernate中的GenerationType.IDENTITY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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