Example usage for javax.persistence FetchType EAGER

List of usage examples for javax.persistence FetchType EAGER

Introduction

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

Prototype

FetchType EAGER

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

Click Source Link

Document

Defines that data must be eagerly fetched.

Usage

From source file:it.infn.ct.futuregateway.apiserver.resources.Task.java

/**
 * Retrieve the list of arguments for the application. This is a list of
 * string the system will use as parameter for the application. Actually,
 * the list will be converted in a space separated string maintaining the
 * order of the list./*from  w  ww. jav a  2 s  . co  m*/
 * <p>
 * The use of the list will depend on the application. In case of an
 * executable the list will be appended to the command line but for a
 * service there is not a standard use at the moment.
 *
 * @return The list of arguments
 */
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "application_arguments", joinColumns = @JoinColumn(name = "id"))
@Column(name = "arguments")
public List<String> getArguments() {
    return arguments;
}

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

/**
 * /*from  w  ww. j  av a 2  s.c o  m*/
 */
@ManyToOne(cascade = {}, fetch = FetchType.EAGER)
@JoinColumn(name = "SpPrincipalID")
@Cascade({ CascadeType.MERGE, CascadeType.LOCK })
public SpPrincipal getGroup() {
    return this.group;
}

From source file:gov.nih.nci.cabig.caaers.domain.report.ReportDefinition.java

/**
 * Gets the planned notifications internal.
 *
 * @return the planned notifications internal
 *//*from w w w.jav a  2 s.  com*/
@OneToMany(fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "rct_id")
@Cascade(value = { CascadeType.ALL })
@Fetch(value = org.hibernate.annotations.FetchMode.SUBSELECT)
public List<PlannedNotification> getPlannedNotificationsInternal() {
    return lazyListHelper.getInternalList(PlannedNotification.class);
}

From source file:org.mitre.oauth2.model.OAuth2AccessTokenEntity.java

/**
 * @return the permissions/*from w  ww. j  a va  2s  .c  o m*/
 */
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinTable(name = "access_token_permissions", joinColumns = @JoinColumn(name = "access_token_id"), inverseJoinColumns = @JoinColumn(name = "permission_id"))
public Set<Permission> getPermissions() {
    return permissions;
}

From source file:gov.nih.nci.firebird.data.AbstractRegistrationForm.java

/**
 * @return the formType// w  w w  . j  a v a2  s. c  om
 */
@ManyToOne(optional = false, cascade = { CascadeType.PERSIST, CascadeType.MERGE,
        CascadeType.REFRESH }, fetch = FetchType.EAGER)
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
@ForeignKey(name = "form_form_type_fkey")
@JoinColumn(name = "form_type_id")
public FormType getFormType() {
    return formType;
}

From source file:gov.nih.nci.cabig.caaers.domain.AdverseEvent.java

/**
 * Gets the low level term./*  w  w w  .  j av  a  2  s .  com*/
 *
 * @return the low level term
 */
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "low_level_term_id")
public LowLevelTerm getLowLevelTerm() {
    return lowLevelTerm;
}

From source file:it.infn.ct.futuregateway.apiserver.resources.Task.java

/**
 * Retrieve the list of output files of the application. This is the list of
 * files the system has to retrieve after the application or the service has
 * completed its execution./*www  .  j  a  va2 s .  c  o m*/
 *
 * @return The output files
 */
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@Fetch(FetchMode.SELECT)
public List<TaskFileOutput> getOutputFiles() {
    return this.outputFiles;
}

From source file:de.terrestris.shogun.model.Group.java

/**
 * @return the mapLayers//from  w w w. j  a v a  2s .  c om
 */
@ManyToMany(fetch = FetchType.EAGER, targetEntity = MapLayer.class)
@JoinTable(name = "TBL_GROUP_TBL_MAPLAYER", joinColumns = {
        @JoinColumn(name = "GROUP_ID", nullable = false, updatable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "MAPLAYER_ID", nullable = false, updatable = false) })
@Fetch(FetchMode.JOIN)
@JsonSerialize(using = LeanBaseModelSetSerializer.class)
public Set<MapLayer> getMapLayers() {
    return mapLayers;
}

From source file:de.terrestris.shogun.model.MapLayer.java

/**
 * @return the metadata//from   w w  w  . j  a  v  a2s. c o m
 */
@OneToMany(fetch = FetchType.EAGER)
@Fetch(FetchMode.SUBSELECT)
@JoinTable(name = "TBL_MAPLAYER_TBL_METADATA")
//   @JsonSerialize(using=LeanBaseModelSerializer.class)
public Set<LayerMetadata> getMetadata() {
    return metadata;
}

From source file:com.impetus.kundera.ejb.EntityResolver.java

/**
 * Helper method to load Foreign Entity/Proxy
 * //from   w w w .  j  ava2s .c om
 * @param entityName
 *            the entity name
 * @param persistentClass
 *            the persistent class
 * @param foreignKey
 *            the foreign key
 * @param relation
 *            the relation
 * @return the foreign entity or proxy
 */
private Object getForeignEntityOrProxy(String entityName, Class<?> persistentClass, String foreignKey,
        EntityMetadata.Relation relation) {

    // Check in session cache!
    Object cached = em.getSession().lookup(persistentClass, foreignKey);
    if (cached != null) {
        return cached;
    }

    FetchType fetch = relation.getFetchType();

    if (fetch.equals(FetchType.EAGER)) {
        log.debug("Eagerly loading >> " + persistentClass.getName() + "_" + foreignKey);
        // load target eagerly!
        return em.immediateLoadAndCache(persistentClass, foreignKey);
    } else {
        log.debug("Creating proxy for >> " + persistentClass.getName() + "#" + relation.getProperty().getName()
                + "_" + foreignKey);

        // metadata
        EntityMetadata m = em.getMetadataManager().getEntityMetadata(persistentClass);

        return em.getFactory().getLazyEntity(entityName, persistentClass, m.getReadIdentifierMethod(),
                m.getWriteIdentifierMethod(), foreignKey, em);
    }
}