io.hyperfoil.tools.horreum.entity.SeqIdGenerator Maven / Gradle / Ivy
package io.hyperfoil.tools.horreum.entity;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.util.Properties;
import java.util.function.Function;
import jakarta.persistence.Id;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.id.factory.spi.CustomIdGeneratorCreationContext;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.Type;
/**
* Custom sequence ID generator that extends {@link SequenceStyleGenerator}.
* This generator does not generate the ID when it is already provided and greater than 0.
*/
public class SeqIdGenerator extends SequenceStyleGenerator {
private static final ClassValue> accessors = new ClassValue>() {
@Override
protected Function