How to write a custom sequence-based String Id generator with JPA and Hibernate

Yes, you can use XML too, but why would you use a deprecated mapping model?

It seems you are using an old Hibernate version. Upgrade to 5.2 and it will work. Or adapt it to the old method signature. It’s very easy. You’ll figure it out.