Example usage for javax.persistence FetchType LAZY

List of usage examples for javax.persistence FetchType LAZY

Introduction

In this page you can find the example usage for javax.persistence FetchType LAZY.

Prototype

FetchType LAZY

To view the source code for javax.persistence FetchType LAZY.

Click Source Link

Document

Defines that data can be lazily fetched.

Usage

From source file:com.hmsinc.epicenter.model.health.Patient.java

@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "patient")
@Sort(type = SortType.NATURAL)/*from w  w w .j  a v  a 2 s  . c o  m*/
public SortedSet<Interaction> getInteractions() {
    return this.interactions;
}

From source file:gov.nih.nci.caarray.domain.hybridization.Hybridization.java

/**
 * Gets the derivedDatas./*from ww  w .  j a  va2  s .co  m*/
 *
 * @return the derivedDatas
 */
@ManyToMany(mappedBy = "hybridizations", targetEntity = AbstractArrayData.class, fetch = FetchType.LAZY)
@Where(clause = "discriminator = '" + DerivedArrayData.DISCRIMINATOR + "'")
@Cascade({ CascadeType.DELETE, CascadeType.SAVE_UPDATE })
public Set<DerivedArrayData> getDerivedDataCollection() {
    return this.derivedDataCollection;
}

From source file:gov.nih.nci.protexpress.domain.protocol.ProtocolApplication.java

/**
 * Gets the inputs./*from ww w.  ja  va 2  s . c  o  m*/
 *
 * @return the inputs.
 */
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable(name = "protapp_inputs", joinColumns = { @JoinColumn(name = "protapp_id") }, inverseJoinColumns = {
        @JoinColumn(name = "input_id") })
public List<InputOutputObject> getInputs() {
    return inputs;
}

From source file:co.jirm.mapper.definition.SqlParameterDefinition.java

static SqlParameterDefinition parameterDef(SqlObjectConfig config, Class<?> objectType, String parameterName,
        Class<?> parameterType, int order) {

    final SqlParameterDefinition definition;
    String sn = null;/* w w w  .jav  a2  s  . com*/
    ManyToOne manyToOne = getAnnotation(objectType, parameterName, ManyToOne.class);
    if (manyToOne != null) {
        Class<?> subK = checkNotNull(manyToOne.targetEntity(), "targetEntity not set");
        JoinColumn joinColumn = getAnnotation(objectType, parameterName, JoinColumn.class);
        SqlObjectDefinition<?> od = SqlObjectDefinition.fromClass(subK, config);
        checkState(!od.getIdParameters().isEmpty(), "No id parameters");
        if (joinColumn != null)
            sn = joinColumn.name();
        if (sn == null)
            sn = config.getNamingStrategy().propertyToColumnName(parameterName);
        FetchType fetch = manyToOne.fetch();
        int depth;
        if (FetchType.LAZY == fetch) {
            depth = 1;
        } else {
            depth = config.getMaximumLoadDepth();

        }
        SqlParameterObjectDefinition sod = new SqlParameterObjectDefinition(od, depth);
        definition = SqlParameterDefinition.newComplexInstance(config.getConverter(), parameterName, sod, order,
                sn);
    } else {
        Column col = getAnnotation(objectType, parameterName, Column.class);
        if (col != null && !isNullOrEmpty(col.name()))
            sn = col.name();
        Id id = getAnnotation(objectType, parameterName, Id.class);
        Version version = getAnnotation(objectType, parameterName, Version.class);
        GeneratedValue generated = getAnnotation(objectType, parameterName, GeneratedValue.class);
        Enumerated enumerated = getAnnotation(objectType, parameterName, Enumerated.class);

        boolean idFlag = id != null;
        boolean versionFlag = version != null;
        boolean generatedFlag = generated != null;
        if (sn == null)
            sn = config.getNamingStrategy().propertyToColumnName(parameterName);
        definition = SqlParameterDefinition.newSimpleInstance(config.getConverter(), parameterName,
                parameterType, order, sn, idFlag, versionFlag, generatedFlag,
                Optional.fromNullable(enumerated));
    }
    return definition;
}

From source file:ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE.java

@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "vocabularyInternal")
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
private Set<VocabularyTermPE> getVocabularyTerms() {
    return terms;
}

From source file:onl.netfishers.netshot.device.DeviceGroup.java

/**
 * Gets the cached devices.
 *
 * @return the cached devices
 */
@ManyToMany(fetch = FetchType.LAZY)
public Set<Device> getCachedDevices() {
    return cachedDevices;
}

From source file:edu.ku.brc.specify.datamodel.Institution.java

/**
 * @return the contentContacts//from  www.  j a va2 s.co m
 */
@OneToMany(cascade = {}, fetch = FetchType.LAZY, mappedBy = "instContentContact")
@org.hibernate.annotations.Cascade({ org.hibernate.annotations.CascadeType.ALL,
        org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public Set<Agent> getContentContacts() {
    return contentContacts;
}

From source file:com.infinities.skyport.entity.User.java

@XmlTransient
@OneToMany(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.REMOVE)
public Set<UserRole> getUserRoles() {
    return this.userRoles;
}

From source file:net.shopxx.entity.Shipping.java

@Valid
@NotEmpty/*w  w  w  .  j  a  v  a  2s .  c o  m*/
@OneToMany(mappedBy = "shipping", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
public List<ShippingItem> getShippingItems() {
    return shippingItems;
}

From source file:com.jeefuse.system.security.model.GsysRole.java

/**
 * ------------------------------------------------------------------------
 * gsysRelUserRoles//from w  ww.  ja  va2s  .c o  m
 * ------------------------------------------------------------------------
 * @generated
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "gsysRole", cascade = CascadeType.REMOVE)
public List<GsysRelUserRole> getGsysRelUserRoles() {
    if (this.gsysRelUserRoles == null) {
        this.gsysRelUserRoles = new ArrayList<GsysRelUserRole>();
    }
    return gsysRelUserRoles;
}