[JIRA] (HHH-16415) SequenceStyleGenerator issue with hibernate 6
by naveeen jug (JIRA)
naveeen jug ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOTQzYTZlNmEx... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16415?atlOrigin=eyJpIjoiOTQzYT... ) HHH-16415 ( https://hibernate.atlassian.net/browse/HHH-16415?atlOrigin=eyJpIjoiOTQzYT... ) SequenceStyleGenerator issue with hibernate 6 ( https://hibernate.atlassian.net/browse/HHH-16415?atlOrigin=eyJpIjoiOTQzYT... )
Issue Type: Bug Affects Versions: 6.0.0 Assignee: Unassigned Created: 01/Apr/2023 11:24 AM Environment: Hibernate 6 and Java 17, spring 3 and JPA 3 Priority: Major Reporter: naveeen jug ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%... )
Recently I have migrate my project from hibernate 5 to 6
We are using a SequenceStyleGenerator to generate sequence for primary key
Eg :working in hibernate 5
public class StringPrefixedSequenceIdGenerator extends SequenceStyleGenerator {
public static final String VALUE_PREFIX_PARAMETER = "valuePrefix" ;
public static final String VALUE_PREFIX_DEFAULT = "";
private String valuePrefix;
public static final String NUMBER_FORMAT_PARAMETER = "numberFormat" ;
public static final String NUMBER_FORMAT_DEFAULT = "%d" ;
private String numberFormat;
@Override
public Serializable generate(SharedSessionContractImplementor session,
Object object) throws HibernateException {
return valuePrefix + String.format(numberFormat, super.generate(session, object));
}
@Override
public void configure(Type type, Properties params,
ServiceRegistry serviceRegistry) throws MappingException {
super.configure(LongType.INSTANCE, params, serviceRegistry);
valuePrefix = ConfigurationHelper.getString(VALUE_PREFIX_PARAMETER,
params, VALUE_PREFIX_DEFAULT);
numberFormat = ConfigurationHelper.getString(NUMBER_FORMAT_PARAMETER,
params, NUMBER_FORMAT_DEFAULT);
}
}
But this logic doesn't work in hibernate 6
Because org.hibarnate.type.LongType is deprecated
And I can find alternative to this
Is any other way to handle the above problem because under org.hibarnate.type most of the types are deprecated
And I can find any article on why this classes were removed and alternative
( https://hibernate.atlassian.net/browse/HHH-16415#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16415#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100221- sha1:57c27f3 )
1 year, 9 months