select setval('hibernate_sequence', (SELECT max(rev) from revinfo));