Example usage for javax.persistence CascadeType PERSIST

List of usage examples for javax.persistence CascadeType PERSIST

Introduction

In this page you can find the example usage for javax.persistence CascadeType PERSIST.

Prototype

CascadeType PERSIST

To view the source code for javax.persistence CascadeType PERSIST.

Click Source Link

Document

Cascade persist operation

Usage

From source file:com.eryansky.entity.base.User.java

@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
// ,????// w w w. j  av  a  2 s  . c om
@JoinTable(name = "T_BASE_USER_ROLE", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = {
        @JoinColumn(name = "ROLE_ID") })
// Fecth
//   @Fetch(FetchMode.SUBSELECT)
// ?id?.
@OrderBy("id")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = CacheConstants.HIBERNATE_CACHE_BASE)
public List<Role> getRoles() {
    return roles;
}

From source file:com.hmsinc.epicenter.model.permission.AuthorizedRegion.java

/**
 * @return the grantedBy//  w  w  w .  j av  a  2s.c o  m
 */
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
@JoinColumn(name = "ID_GRANTING_ORGANIZATION", unique = false, nullable = false, insertable = true, updatable = true)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@org.hibernate.annotations.ForeignKey(name = "FK_AUTHORIZED_REGION_3")
public Organization getGrantedBy() {
    return grantedBy;
}

From source file:com.eryansky.entity.base.Resource.java

@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "PARENT_ID")
public Resource getParentResource() {
    return parentResource;
}

From source file:com.eryansky.entity.sys.Dictionary.java

@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "DICTIONARYTYPE_CODE", referencedColumnName = "CODE")
public DictionaryType getDictionaryType() {
    return dictionaryType;
}

From source file:com.eryansky.entity.base.Role.java

@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
// ,????//from   w  w w  .  ja v  a 2 s . c  om
@JoinTable(name = "T_BASE_USER_ROLE", joinColumns = { @JoinColumn(name = "ROLE_ID") }, inverseJoinColumns = {
        @JoinColumn(name = "USER_ID") })
@OrderBy("id")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = CacheConstants.HIBERNATE_CACHE_BASE)
public List<User> getUsers() {
    return users;
}

From source file:com.doculibre.constellio.entities.ConnectorType.java

@OneToMany(mappedBy = "connectorType", cascade = { CascadeType.PERSIST, CascadeType.MERGE })
public Set<ConnectorTypeMetaMapping> getMetaMappings() {
    return metaMappings;
}

From source file:org.caratarse.auth.model.po.User.java

@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "user")
@Filters({ @Filter(name = "limitByNotDeleted") })
public List<UserAuthorization> getUserAuthorizations() {
    if (userAuthorizations == null) {
        userAuthorizations = new LinkedList<UserAuthorization>();
    }/*from   ww w .j av  a 2  s  .c  o m*/
    return userAuthorizations;
}

From source file:com.hmsinc.epicenter.model.surveillance.SurveillanceSet.java

/**
 * @return the datatype/* w ww.  ja  v a 2 s .  c  o m*/
 */
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
@JoinColumn(name = "ID_DATA_TYPE", unique = false, nullable = false, insertable = true, updatable = true)
@ForeignKey(name = "FK_SURVEILLANCE_SET_2")
public DataType getDatatype() {
    return datatype;
}

From source file:com.eryansky.entity.base.Resource.java

@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
@JoinTable(name = "T_BASE_ROLE_RESOURCE", joinColumns = {
        @JoinColumn(name = "RESOURCE_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = CacheConstants.HIBERNATE_CACHE_BASE)
public List<Role> getRoles() {
    return roles;
}

From source file:edu.harvard.med.screensaver.model.AttachedFile.java

@ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "attachedFileUpdateActivity", joinColumns = @JoinColumn(name = "attachedFileId", nullable = false, updatable = false), inverseJoinColumns = @JoinColumn(name = "updateActivityId", nullable = false, updatable = false, unique = true))
@org.hibernate.annotations.Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE })
@Sort(type = SortType.NATURAL)/*from   w  w  w  . ja v a2 s.c  o m*/
@ToMany(singularPropertyName = "updateActivity", hasNonconventionalMutation = true /* model testing framework doesn't understand this is a containment relationship, and so requires addUpdateActivity() method*/)
@Override
public SortedSet<AdministrativeActivity> getUpdateActivities() {
    return _updateActivities;
}