HHH-15633 Intern entity name to improve EntityKey#equals
This commit is contained in:
parent
0561839140
commit
ec72bab0a9
|
@ -10,7 +10,6 @@ import java.io.IOException;
|
|||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
@ -103,7 +102,7 @@ public final class EntityKey implements Serializable {
|
|||
|
||||
private boolean samePersistentType(final EntityKey otherKey) {
|
||||
return otherKey.persister == persister
|
||||
|| Objects.equals( otherKey.persister.getRootEntityName(), persister.getRootEntityName() );
|
||||
|| otherKey.persister.getRootEntityName().equals( persister.getRootEntityName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -147,8 +147,9 @@ public class EntityMetamodel implements Serializable {
|
|||
RuntimeModelCreationContext creationContext) {
|
||||
this.sessionFactory = creationContext.getSessionFactory();
|
||||
|
||||
name = persistentClass.getEntityName();
|
||||
rootName = persistentClass.getRootClass().getEntityName();
|
||||
// Improves performance of EntityKey#equals by avoiding content check in String#equals
|
||||
name = persistentClass.getEntityName().intern();
|
||||
rootName = persistentClass.getRootClass().getEntityName().intern();
|
||||
|
||||
identifierAttribute = PropertyFactory.buildIdentifierAttribute(
|
||||
persistentClass,
|
||||
|
|
Loading…
Reference in New Issue