Below is the entity configuration:
@Entity
@SequenceGenerator(
name = "sessionInfoIdSeq",
sequenceName = "SESSIONINFO_ID_SEQ"
)
public class SessionInfo implements Transformable {
@Id
@GeneratedValue(
strategy = GenerationType.AUTO,
generator = "sessionInfoIdSeq"
)
private Long id;
This means when inserting data into the database, the id will be fetched from the SESSIONINFO_ID_SEQ:
select nextval ('SESSIONINFO_ID_SEQ')
But the problem is, the next sequence number get by Spring boot app + Hibernate is not being the same as when we run the native query in DataGrip or DBeaver, although I've seen the app used the same query that used in Datagrip.
Spring boot + hibernate at runtime: 12749 Running native query in DataGrip: 12797
I'm not sure why this is appearing. But the question is how can I sync the sequence number, to when the app takes a new one, we can see the same on Datagrip or DBeaver.
Let me know if the question is existing or not correct. Thank you in advance for all your support.