Reputation: 758
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
I have seen different threads of coderanch and stackoverflow, what i found:
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.
Please let me know, if trouble is from database side or java? Any suggestion/advice would be greatly appreciated.
Upvotes: 0
Views: 4044
Reputation: 758
My problem is solved now. Hibernate was using a sequence automatically. So I provided the grant to that sequence now its working.
Upvotes: 0
Reputation: 23371
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. 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
.
2 - You are using a wrong sequence in your code, since you mentioned it should be
@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.
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. 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.
Upvotes: 2