hibernate could not get next sequence value

后端 未结 11 1427
夕颜
夕颜 2020-11-29 23:32

i have gwt application connect to postgres DB at the backend, and a java class \'Judgement\' mapping the table \'judgements\' in DB, when i tried to persistent a judgement i

11条回答
  •  既然无缘
    2020-11-30 00:33

    I think you already have enough answer, but I got exactly the same error and my problem was another one. And I wasted a little bit of time trying to solve it.

    In my case the problem was the owner of sequence in Postgres. So, if any solution above did not solved your problem, check if the owner of sequence is the user/role which should have permission.

    Follows a sample:

    CREATE SEQUENCE seq_abcd
        START WITH 1
        INCREMENT BY 1
        NO MINVALUE
        NO MAXVALUE
        CACHE 1;
    
    ALTER TABLE public.seq_abcd OWNER TO USER_APP;
    

    I hope it can be useful for anyone.

提交回复
热议问题