List of usage examples for javax.persistence CascadeType PERSIST
CascadeType PERSIST
To view the source code for javax.persistence CascadeType PERSIST.
Click Source Link
From source file:com.impetus.kundera.ejb.EntityManagerImpl.java
@Override public final void persist(Object e) { if (e == null) { throw new IllegalArgumentException("Entity must not be null."); }// w w w. j a va 2s . co m try { // validate metadataManager.validate(e.getClass()); List<EnhancedEntity> reachableEntities = entityResolver.resolve(e, CascadeType.PERSIST, this.client.getType()); // save each one for (EnhancedEntity o : reachableEntities) { log.debug("Persisting @Entity >> " + o); EntityMetadata metadata = metadataManager.getEntityMetadata(o.getEntity().getClass()); metadata.setDBType(this.client.getType()); // TODO: throw EntityExistsException if already exists // fire pre-persist events eventDispatcher.fireEventListeners(metadata, o, PrePersist.class); //TODO uncomment dataManager.persist(o, metadata); getIndexManager().write(metadata, o.getEntity()); // fire post-persist events eventDispatcher.fireEventListeners(metadata, o, PostPersist.class); } } catch (Exception exp) { throw new PersistenceException(exp); } }
From source file:gov.nih.nci.firebird.data.AbstractCredential.java
/** * @return issuer organization//from w ww. j a v a 2 s . c o m */ @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }) @Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE) @JoinColumn(name = "issuer_id") @ForeignKey(name = "credential_organization_fkey") public Organization getIssuer() { return issuer; }
From source file:com.hmsinc.epicenter.model.surveillance.SurveillanceTask.java
/** * @return the methods//w w w .j av a 2 s .co m */ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY, targetEntity = SurveillanceMethod.class) @JoinTable(name = "SURVEILLANCE_TASK_METHOD", joinColumns = { @JoinColumn(name = "ID_SURVEILLANCE_TASK") }, inverseJoinColumns = { @JoinColumn(name = "ID_SURVEILLANCE_METHOD") }) @ForeignKey(name = "FK_SURVEILLANCE_TASK_METHOD_1", inverseName = "FK_SURVEILLANCE_TASK_METHOD_2") public Set<SurveillanceMethod> getMethods() { return methods; }
From source file:com.hmsinc.epicenter.model.workflow.Investigation.java
/** * @return the events/*from w w w. j a v a 2 s. co m*/ */ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY, targetEntity = Event.class) @JoinTable(name = "INVESTIGATION_EVENT", joinColumns = { @JoinColumn(name = "ID_INVESTIGATION") }, inverseJoinColumns = { @JoinColumn(name = "ID_EVENT") }) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Sort(type = SortType.NATURAL) public SortedSet<Event> getEvents() { return events; }
From source file:com.hmsinc.epicenter.model.permission.Organization.java
/** * @return the sponsoredOrganizations/*from ww w . ja v a 2 s.co m*/ */ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "sponsors", targetEntity = Organization.class) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public Set<Organization> getSponsoredOrganizations() { return sponsoredOrganizations; }
From source file:com.hmsinc.epicenter.model.provider.Facility.java
/** * @return the dataConnections/*from w w w . j a v a2 s. com*/ */ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "facilities", targetEntity = DataConnection.class) @ForeignKey(name = "FK_DATA_CONN_FACILITY_1", inverseName = "FK_DATA_CONN_FACILITY_2") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public Set<DataConnection> getDataConnections() { return dataConnections; }
From source file:com.denimgroup.threadfix.data.entities.Application.java
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinColumn(name = "defectTrackerId") @JsonView({ AllViews.TableRow.class, AllViews.FormInfo.class, AllViews.RestViewTeams2_1.class, AllViews.RestViewWafs2_1.class }) public DefectTracker getDefectTracker() { return defectTracker; }
From source file:com.hmsinc.epicenter.model.permission.Organization.java
/** * @return the sponsors//from w ww .j a v a 2s.c o m */ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY, targetEntity = Organization.class) @JoinTable(name = "ORGANIZATION_SPONSOR", joinColumns = { @JoinColumn(name = "ID_ORGANIZATION") }, inverseJoinColumns = { @JoinColumn(name = "ID_SPONSOR_ORG") }) @ForeignKey(name = "FK_ORGANIZATION_SPONSOR_1", inverseName = "FK_ORGANIZATION_SPONSOR_2") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public Set<Organization> getSponsors() { return sponsors; }
From source file:com.hmsinc.epicenter.model.workflow.Investigation.java
/** * @return the localities//from w w w. java2s . com */ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY, targetEntity = Geography.class) @JoinTable(name = "INVESTIGATION_GEOGRAPHY", joinColumns = { @JoinColumn(name = "ID_INVESTIGATION") }, inverseJoinColumns = { @JoinColumn(name = "ID_GEOGRAPHY") }) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @org.hibernate.annotations.ForeignKey(name = "FK_INVESTIGATION_GEOGRAPHY_1", inverseName = "FK_INVESTIGATION_GEOGRAPHY_2") public Set<Geography> getLocalities() { return localities; }
From source file:com.hmsinc.epicenter.model.provider.Facility.java
/** * @return the types/* ww w . j av a 2s. co m*/ */ @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "facilities", targetEntity = FacilityType.class) @ForeignKey(name = "FK_FACILITY_TYPE_FACILITY_1", inverseName = "FK_FACILITY_TYPE_FACILITY_2") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public Set<FacilityType> getTypes() { return types; }