使用Hibernate从Oracle序列中提取 [英] Pull from Oracle sequence with Hibernate

查看:129
本文介绍了使用Hibernate从Oracle序列中提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Oracle数据库中定义了一个序列。
我可以使用Hibernate从这个序列中抽出吗?我不想使用序列来为我的对象生成id,所以 @GeneratedValue @Id 不是我正在寻找的东西。

I've a sequence defined in my Oracle database. Can I pull from this sequence using Hibernate? I don't want to use the sequence for generating ids for my objects, so @GeneratedValue and @Id are not the things I am looking for.

推荐答案

类似这样的:

Something like this:

  <sql-query name="sequenceValue">  
     <return alias="mySeq" class="MySequences"/>  
       select my_schema.seq_myid.nextval as mySeq from dual  
  </sql-query> 

这篇关于使用Hibernate从Oracle序列中提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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