I am working on application where three environments are there. test, int and production db.
I have a table, if I observe the generated SQL in SQL developer for primary key
ID" NUMBER GENERATED BY DEFAULT AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE NOT NULL ENABLE,
If I see on table it looks like...
"SCHEMA"."ISEQ$$_97103".nextval
on JPA/eclipselink entity I used this ISEQ$$_97103 sequence generator it worked on test environment.
But, when I executed this on INT environment it throws error ISEQ$$_97103 sequence does not exist. I observed that, it's a different name in INT database.
As they system generated names they would be different.
I tried with the following link but no use
https://www.thoughts-on-java.org/hibernate-tips-use-auto-incremented-column-primary-key/
How to specify in JPA use system generated identity names from table? is there any way? or is is mandatory that the name should be same in three environments.
Here is my entity class:
@Entity
@Table(name = "T_MY_TABLE")
public class MyDataEntity implements Serializable {
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// other colums, getters/setters
}
Error I am getting
Internal Exception: java.sql.SQLException: ORA-02289: sequence does not exist
Error Code: 2289
Call: SELECT SEQ_GEN_IDENTITY.NEXTVAL FROM DUAL
Query: ValueReadQuery(sql="SELECT SEQ_GEN_IDENTITY.NEXTVAL FROM DUAL
I am really wondering, I haven't mentioned anything related to Sequence but why it's reading the value from sequence.