简体   繁体   English

嵌套的异常是org.hibernate.exception.SQLGrammarException:ORA-02289:序列不存在

[英]nested exception is org.hibernate.exception.SQLGrammarException: ORA-02289: sequence does not exist

EDIT: 编辑:

@NamedQueries({
    @NamedQuery(name="getOLTsByProcessStateAndAssignee",query="select o from Olt o where o.activityProcessId IN(:procId) order by modifiedtime desc"),
    @NamedQuery(name="getOLTsByProcessStateAndAssigneeForSearch",query="select o from Olt o where o.activityProcessId IN(:procId) and o.name like :name order by modifiedtime desc"),
    @NamedQuery(name="findOltbyname",query="select o from Olt o where o.name=:oltname and o.jioCenter.id=:jioCenterId"),
 })
@XmlRootElement(name="Olt") @Audited @Entity
@Table(name="olt")
public class Olt extends BaseEntity implements Serializable
{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;


    /*@GeneratedValue(generator="olt_id_gen")
    @GenericGenerator(name = "olt_id_gen",
        strategy = "com.inn.fttx.model.IntegerSequenceGenerator",
        parameters = {
            @Parameter(name="sequence" , value="OLT_ID_SEQ")
        })
    @Id  */



    @SequenceGenerator(name = "olt_id_SEQ", sequenceName = "olt_id_SEQ", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="olt_id_SEQ")

here I am getting the following exception - 在这里,我得到以下异常-

nested exception is org.hibernate.exception.SQLGrammarException: ORA-02289: sequence does not exist 嵌套的异常是org.hibernate.exception.SQLGrammarException:ORA-02289:序列不存在

I have seen different threads of coderanch and stackoverflow, what i found: 我发现了不同的coderanch和stackoverflow线程,发现了什么:

  1. the Oracle database is running (Most likely) Oracle数据库正在运行(极有可能)
  2. you app is connected to it (Most likely) 您的应用已连接到它(很有可能)
  3. You are connected to the correct database (Maybe/Maybe not) 您已连接到正确的数据库(可能/可能未连接)
  4. There is actually a sequence table called "olt_id_SEQ" 实际上有一个称为“ olt_id_SEQ”的序列表

I just pasted this points above, so i can show what I have done already. 我只是在上面粘贴了这些要点,所以我可以显示我已经做了什么。

But in my Oracle database, I have this sequence and i can perform select with nextval on it. 但是在我的Oracle数据库中,我有这个顺序,我可以对其执行nextval选择。

Please let me know, if trouble is from database side or java? 请让我知道,如果麻烦是来自数据库方面还是java? Any suggestion/advice would be greatly appreciated. 任何建议/建议将不胜感激。

If your statement There is actually a sequence table called "CUSTOMER_ID_sequence" makes no sense since your code is trying to reach the olt_id_SEQ sequence. 如果您的语句There is actually a sequence table called "CUSTOMER_ID_sequence"则没有意义,因为您的代码正在尝试到达olt_id_SEQ序列。 And a sequence is not a table. 而且序列不是表格。

So there are two options here: 因此,这里有两个选择:

1 - The user you are using to connect to oracle does not have proper grants on that sequence olt_id_SEQ . 1-您用于连接到oracle的用户对该序列olt_id_SEQ没有适当的授予。

2 - You are using a wrong sequence in your code, since you mentioned it should be 2-您在代码中使用了错误的序列,因为您提到的应该是

 @SequenceGenerator(name = "CUSTOMER_ID_sequence", 
                    sequenceName = "CUSTOMER_ID_sequence", allocationSize=1)
 @GeneratedValue(strategy=GenerationType.SEQUENCE, 
                 generator="CUSTOMER_ID_sequence")

Edit 编辑

The OP edited his question but the problem here still are the same as I mentioned above. OP编辑了他的问题,但是这里的问题仍然与我上面提到的相同。

1 - The user you are using to connect to oracle does not have proper grants on that sequence olt_id_SEQ or this sequence doesn't exists at all. 1-您用来连接到oracle的用户对该序列olt_id_SEQ没有适当的授予olt_id_SEQ或者该序列根本不存在。 To check that get the user and password that you use on your application and run this query: 要检查是否获得您在应用程序上使用的用户名密码并运行此查询,请执行以下操作:

select * from all_objects where object_name = 'OLT_ID_SEQ'

If this query do not return any row the sequence does not exist or it doesn't have a grant to it. 如果此查询不返回任何行,则序列不存在或没有授予它的权限。

See what was the schema that is the owner of the sequence. 查看什么是序列所有者的架构。 If you are using an user that has limited permission you may need to use: [schemaName].olt_id_SEQ or create a public synonim to this sequence. 如果您使用的用户权限有限,则可能需要使用:[schemaName] .olt_id_SEQ或为此序列创建一个公共同义词。

My problem is solved now. 我的问题现在解决了。 Hibernate was using a sequence automatically. Hibernate正在自动使用序列。 So I provided the grant to that sequence now its working. 因此,我为该顺序提供了支持,现在它可以正常工作了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“主” org.hibernate.exception.SQLGrammarException中的异常:ORA-02289:序列不存在 - Exception in thread “main” org.hibernate.exception.SQLGrammarException: ORA-02289: sequence does not exist 错误:ORA-02289:序列不存在 - org.hibernate.exception.SQLGrammarException:无法提取 ResultSet - ERROR: ORA-02289: sequence does not exist - org.hibernate.exception.SQLGrammarException: could not extract ResultSet ORA-02289:将Hibernate 3升级到休眠4时序列不存在 - ORA-02289: sequence does not exist when upgrade Hibernate 3 to hibernate 4 JPA(休眠):“ ORA-02289序列不存在”,但确实存在 - JPA (Hibernate): “ORA-02289 Sequence does not exist”, but it does org.hibernate.exception.SQLGrammarException:无法提取ResultSet和错误:关系“ hibernate_sequence”不存在 - org.hibernate.exception.SQLGrammarException: could not extract ResultSet and ERROR: relation “hibernate_sequence” does not exist 嵌套的异常是org.hibernate.exception.SQLGrammarException:无法执行查询 - nested exception is org.hibernate.exception.SQLGrammarException: could not execute query org.hibernate.exception.SQLGrammarException:无法获取下一个序列值 - org.hibernate.exception.SQLGrammarException: could not get next sequence value JPA 异常:org.hibernate.exception.SQLGrammarException - JPA Exception: org.hibernate.exception.SQLGrammarException 获取异常:org.hibernate.exception.sqlgrammarexception - Getting Exception : org.hibernate.exception.sqlgrammarexception 获取异常org.hibernate.exception.SQLGrammarException: - getting exception org.hibernate.exception.SQLGrammarException:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM