Custom SequenceStyleGenerator with External Enum for String Prefix Sequences

I am trying to create a sequence with a String Prefix of type CUSTOM-SEQ-<env>-<enum>-XXXX where <env> is environment variable, <enum> is an Enum class and XXXX is number sequence to be generated.

I have created by Entity as follows:

public class Employee {

    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "employee_seq_generator")
       strategy = "com.ayman.domain.generator.StringPrefixedSequenceIdGenerator",
            parameters = {
                    @Parameter(name = StringPrefixedSequenceIdGenerator.INCREMENT_PARAM, value = "50"),        // Increment value
                    @Parameter(name = StringPrefixedSequenceIdGenerator.VALUE_PREFIX_PARAMETER, value = "EMP_")}) // String Prefix
    @Column(name = "id", updatable = false, nullable = false)
    private String id;

And this is my Sequence Generator StringPrefixedSequenceIdGenerator:

public class StringPrefixedSequenceIdGenerator extends SequenceStyleGenerator {

    public static final String VALUE_PREFIX_PARAMETER = "valuePrefix";
    public static final String VALUE_PREFIX_DEFAULT = "";
    private String valuePrefix;

    private String valuePrefix1;

    public Serializable generate(SharedSessionContractImplementor session,
                                 Object object) throws HibernateException {
        return valuePrefix + String.format(numberFormat, super.generate(session, object));

    public void configure(Type type, Properties params,
                          ServiceRegistry serviceRegistry) throws MappingException {

        super.configure(LongType.INSTANCE, params, serviceRegistry);
        valuePrefix1 = ConfigurationHelper.getString(VALUE_PREFIX_PARAMETER,
                customMapParams, VALUE_PREFIX_DEFAULT);
        valuePrefix = ConfigurationHelper.getString(VALUE_PREFIX_PARAMETER,
                params, VALUE_PREFIX_DEFAULT);"!! configure-valueFormat: {} --- {}", valuePrefix, valuePrefix1);

   private Map<String, String> customMapParams() {
        Map<String, String> mapValues = new HashMap<>();
        mapValues.put("EmployeeType", EmployeeType.Temp.toString());
        mapValues.put("Env", System.getEnv("envvalue"));
        return mapValues;


I am getting the response as EMP_1

I want to be something like this EMP_Temp_envvalue_1

Did you try to debug this? Is the configure method not called?

I was trying to pass in non-constant values from Entity layer through Parameters which I learnt is not possible. Can close this question since my problem requires an alternative solution.