Example usage for org.hibernate.type CompositeType getFetchMode

List of usage examples for org.hibernate.type CompositeType getFetchMode

Introduction

In this page you can find the example usage for org.hibernate.type CompositeType getFetchMode.

Prototype

FetchMode getFetchMode(int index);

Source Link

Document

Retrieve the fetch mode of the indicated component property.

Usage

From source file:org.babyfish.hibernate.internal.ImplicitCollectionJoins.java

License:Open Source License

private boolean hasImplicitCollectionJoins0(CompositeType compositeType, Map<String, Boolean> contextMap) {
    Type[] subtypes = compositeType.getSubtypes();
    for (int i = subtypes.length - 1; i >= 0; i--) {
        Type subtype = subtypes[i];
        if (compositeType.getFetchMode(i) == FetchMode.JOIN) {
            if (subtype.isCollectionType()) { //find collection with {fetch = "join"}
                return true;
            }/* www .j ava  2s.c o m*/
            if (subtype instanceof AssociationType) {
                String childEntityName = ((AssociationType) subtype).getAssociatedEntityName(this.factory);
                if (this.hasImplicitCollectionJoins0(childEntityName, contextMap)) {
                    return true;
                }
            }
        } else if (subtype instanceof CompositeType) {
            if (this.hasImplicitCollectionJoins0((CompositeType) subtype, contextMap)) {
                return true;
            }
        }
    }
    return false;
}