Example usage for org.hibernate.persister.collection CollectionPersister hasIndex

List of usage examples for org.hibernate.persister.collection CollectionPersister hasIndex

Introduction

In this page you can find the example usage for org.hibernate.persister.collection CollectionPersister hasIndex.

Prototype

boolean hasIndex();

Source Link

Document

Is this an "indexed" collection?

Usage

From source file:com.blazebit.persistence.integration.hibernate.base.HibernateJpaProvider.java

License:Apache License

@Override
public boolean isBag(EntityType<?> ownerType, String attributeName) {
    CollectionPersister persister = null;
    IdentifiableType<?> type = ownerType;
    String typeName = getTypeName(ownerType);
    StringBuilder sb = new StringBuilder(typeName.length() + attributeName.length() + 1);
    while (persister == null && type != null) {
        sb.setLength(0);//www.ja  v a 2  s. com
        sb.append(getTypeName(type));
        sb.append('.');
        sb.append(attributeName);
        persister = collectionPersisters.get(sb.toString());
        type = type.getSupertype();
    }

    return persister != null && !persister.hasIndex() && !persister.isInverse()
            && !(getAttribute(ownerType, attributeName) instanceof SetAttribute<?, ?>);
}