How to implement Seed and Next when extending UserVersionType

How to implement Seed and Next when extending UserVersionType

I'm trying to implement a String based UserVersionType. I have found examples enough to understand how to use the UserType methods to an extent. I can't find anything that shows me exactly what to do with next() and seed().

I'm trying to implement a String based UserVersionType. I have found examples enough to understand how to use the UserType methods to an extent. I can't find anything that shows me exactly what to do with next() and seed().

So I have something like this

public class StringVersionType implements UserType, UserVersionType {
    ...

public int compare(Object o1, Object o2) {
    String a = (String) o1;
    String b = (String) o2;

    return a.compareTo(b);
}

public Object next(Object arg0, SharedSessionContractImplementor arg1)           
{

       return "DUMMY SEED";  // + LocalTime.now().toString();
}

public Object seed(SharedSessionContractImplementor session){
    return "DUMMY SEED"; // LocalTime.now().toString();
}

}

I've tried adding simple code to return a string that is always the same and code that might change the version number. I always get an error on update. Looking at the hibernate console output when I add almost anything to these UserVersionType methods hibernate stops doing a select and then an update but always goes straight to a new insert query and so fails on a primary key still exists.

Obviously I'm misunderstanding what seed and next should do but I can't find any useful documentation ?

Can anyone tell me more about how to use them ?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Java Fundamentals: Learn Java for absolute beginners |Simpliv

Java Fundamentals: Learn Java for absolute beginners

Java Essentials : Learn Core Java From Basic to Advance

Learn Java Programming Using Practical Assignments. Start Building Back-end Web Applications Robust Test Automation Frameworks By End Of The Course. Learn More!

Hibernate Tutorial For Beginners - Hibernate Full Course

Learn Hibernate Tutorial. In this Hibernate tutorial for beginners and professionals with inheritance mapping, collection mapping, component mapping, hibernate caching, hibernate query language, What is JPA? & JPA Implementation