How to restart PostgreSQL sequences processed by Hibernate?

I was instructed to restart the sequence for many different sequential columns in the PostgreSQL database. Normally I would just use:

ALTER SEQUENCE serial RESTART WITH 105;

However, it appears that Hibernate is used to process database sequences. I really don't know anything about Hibernate, but I understand that hibernate_sequence is a global sequence for all tables. It is right?

I assume that I will need to do the following, and then:

ALTER SEQUENCE hibernate_sequence RESTART WITH 105;

But I'm not sure what will be the consequence. Suppose I have tables A, B, C, and D. Each of these tables has a serial identifier column. Will the above SQL statement on hibernate_sequence restart the identifier column for ALL tables?

Thank!

+5
1

-, : , - . . .

, Hibernate, , . Hibernate , .

, - , , Hibernate . hibernate_sequence . , , , hibernate_sequence, .

, .

(), , Hibernate, ALTER SEQUENCE . JPA, @SequenceGenerator @GeneratedValue GenerationType.SEQUENCE. orm.xml, hbm.xml Hibernate , . , Hibernate , , , , SELECT * FROM sequence_name.

() hibernate_sequence, , , , , Hibernate. , (-) , `LOCK TABLE , .

. ? , - , . ?

+4

All Articles