andrel
andrel

Reputation: 1154

Hibernate AuditProperty got a new 'alias' argument in 5.1.1.Final

I notice that when upgrading to Hibernate 5.1.1.Final (from 5.1.0.Final), that a new String alias-property was added to AuditProperty.

The change seems to have been introduced in HHH-11025

The constructor signature was changed from

public AuditProperty(PropertyNameGetter propertyNameGetter)

to

public AuditProperty(String alias, PropertyNameGetter propertyNameGetter)

What is this new alias argument? I have a legacy application that creates an AuditProperty and I'm not sure what I should pass as the alias parameter.

Upvotes: 0

Views: 148

Answers (1)

Naros
Naros

Reputation: 21153

You can simply pass null for the alias.

If you take a look at AuditEntity, you'll notice several use cases where the old methods that don't deal with aliases, such as the following simply delegate to the new implementation using null.

public static AuditProperty<RevisionType> revisionType() {
  return revisionType( null );
}

public static AuditProperty<RevisionType> revisionType(String alias) {
  return new AuditProperty<>( alias, new RevisionTypePropertyName() );
}

Upvotes: 1

Related Questions