javax.persistence.CascadeType Java Examples

The following examples show how to use javax.persistence.CascadeType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwedenParliamentElectoralRegionContainer.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the parliament electoral regions.
*
* @return the parliament electoral regions
*/
  @OneToMany(targetEntity = SwedenParliamentElectoralRegion.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "PARLIAMENT_ELECTORAL_REGIONS_0")
  public List<SwedenParliamentElectoralRegion> getParliamentElectoralRegions() {
      return this.parliamentElectoralRegions;
  }
 
Example #2
Source File: DataElement.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the data.
*
* @return the data
*/
  @OneToMany(targetEntity = WorldBankData.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "DATA__DATA_ELEMENT_HJID")
  public List<WorldBankData> getData() {
      return this.data;
  }
 
Example #3
Source File: ReplicationConfiguration.java    From juddi with Apache License 2.0 5 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Operator.class)
public List<Operator> getOperator() {
        if (operator == null) {
                operator = new ArrayList<Operator>();
        }
        return this.operator;
}
 
Example #4
Source File: A.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL)
public List<EItem> getEItems() {
	if (eItems == null) {
		eItems = new ArrayList<EItem>();
	}
	if (ItemUtils.shouldBeWrapped(e))
		e = ItemUtils.wrap(e, eItems, EItem.class);
	return this.eItems;
}
 
Example #5
Source File: CommitteeProposalContainer.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the committee proposal list.
*
* @return the committee proposal list
*/
  @OneToMany(targetEntity = CommitteeProposalData.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "COMMITTEE_PROPOSAL_LIST_COMM_0")
  public List<CommitteeProposalData> getCommitteeProposalList() {
      return this.committeeProposalList;
  }
 
Example #6
Source File: PersonElement.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the person assignment element.
*
* @return the person assignment element
*/
  @ManyToOne(targetEntity = PersonAssignmentElement.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "PERSON_ASSIGNMENT_ELEMENT_PE_0")
  public PersonAssignmentElement getPersonAssignmentElement() {
      return personAssignmentElement;
  }
 
Example #7
Source File: A.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL)
public List<GItem> getGItems() {
	if (gItems == null) {
		gItems = new ArrayList<GItem>();
	}
	if (ItemUtils.shouldBeWrapped(g))
		g = ItemUtils.wrap(g, gItems, GItem.class);
	return this.gItems;
}
 
Example #8
Source File: PersonAssignmentData.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the assignment list.
*
* @return the assignment list
*/
  @OneToMany(targetEntity = AssignmentData.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "ASSIGNMENT_LIST_PERSON_ASSIG_0")
  public List<AssignmentData> getAssignmentList() {
      return this.assignmentList;
  }
 
Example #9
Source File: BallotContainer.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the ballot document element.
*
* @return the ballot document element
*/
  @ManyToOne(targetEntity = BallotDocumentElement.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "BALLOT_DOCUMENT_ELEMENT_BALL_0")
  public BallotDocumentElement getBallotDocumentElement() {
      return ballotDocumentElement;
  }
 
Example #10
Source File: ProjectHelper.java    From angularjs-addon with Eclipse Public License 1.0 5 votes vote down vote up
public void createManyToOneField(Project project, JavaResource javaResource, String fieldName,
         String type, String inverseFieldName, FetchType fetchType, boolean required,
         Iterable<CascadeType> cascadeTypes) throws FileNotFoundException
{
   jpaFieldOperations.newManyToOneRelationship(project, javaResource, fieldName, type, inverseFieldName, fetchType,
            required, cascadeTypes);
}
 
Example #11
Source File: Node.java    From ankush with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @return the configuration
 */
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JoinColumns({
		@JoinColumn(name = "clusterId", referencedColumnName = "clusterId"),
		@JoinColumn(name = "host", referencedColumnName = "publicIp") })
public List<Configuration> getConfiguration() {
	return configuration;
}
 
Example #12
Source File: JpaConfigHelper.java    From celerio with Apache License 2.0 5 votes vote down vote up
public static String jpaCascade(PackageImportAdder importAdder, CascadeGetter... cascadeGetters) {
    if (cascadeGetters == null) {
        return "";
    }

    // we look for the first non empty conf.
    // not that it could be a NONE conf => user does not want any cascade.

    for (CascadeGetter cascadeGetter : cascadeGetters) {
        if (cascadeGetter != null) {
            List<Cascade> cascadeConf = cascadeGetter.getCascades();

            if (cascadeConf != null && cascadeConf.size() > 0) {
                List<CascadeType> cascades = convertJpaCascade(cascadeConf);
                // we could have removed the NONE element, so we check for emptiness.
                if (!cascades.isEmpty()) {
                    for (CascadeType ct : cascades) {
                        importAdder.addImport("static javax.persistence.CascadeType." + ct.name());
                    }

                    AttributeBuilder ab = new AttributeBuilder();
                    ab.add("cascade", convertJpaCascadeToStrings(cascades));
                    return ab.getAttributes();
                } else {
                    return ""; // there was 1 element: NONE => user does not want anything, we bail out.
                }
            }
        }
    }

    return "";
}
 
Example #13
Source File: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void getCascades(AnnotationDescriptor ad, Element element, XMLContext.Default defaults) {
	List<Element> elements = element != null ? element.elements( "cascade" ) : new ArrayList<>( 0 );
	List<CascadeType> cascades = new ArrayList<>();
	for ( Element subelement : elements ) {
		if ( subelement.element( "cascade-all" ) != null ) {
			cascades.add( CascadeType.ALL );
		}
		if ( subelement.element( "cascade-persist" ) != null ) {
			cascades.add( CascadeType.PERSIST );
		}
		if ( subelement.element( "cascade-merge" ) != null ) {
			cascades.add( CascadeType.MERGE );
		}
		if ( subelement.element( "cascade-remove" ) != null ) {
			cascades.add( CascadeType.REMOVE );
		}
		if ( subelement.element( "cascade-refresh" ) != null ) {
			cascades.add( CascadeType.REFRESH );
		}
		if ( subelement.element( "cascade-detach" ) != null ) {
			cascades.add( CascadeType.DETACH );
		}
	}
	if ( Boolean.TRUE.equals( defaults.getCascadePersist() )
			&& !cascades.contains( CascadeType.ALL ) && !cascades.contains( CascadeType.PERSIST ) ) {
		cascades.add( CascadeType.PERSIST );
	}
	if ( cascades.size() > 0 ) {
		ad.setValue( "cascade", cascades.toArray( new CascadeType[cascades.size()] ) );
	}
}
 
Example #14
Source File: DocumentStatusContainer.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the document.
*
* @return the document
*/
  @ManyToOne(targetEntity = DocumentData.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "DOCUMENT_DOCUMENT_STATUS_CON_0")
  public DocumentData getDocument() {
      return document;
  }
 
Example #15
Source File: Reference.java    From livingdoc-core with GNU General Public License v3.0 5 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "SUT_ID")
public SystemUnderTest getSystemUnderTest() {
    return systemUnderTest;
}
 
Example #16
Source File: SwedenCountyElectoralRegionContainer.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the county electoral regions.
*
* @return the county electoral regions
*/
  @OneToMany(targetEntity = SwedenCountyElectoralRegion.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "COUNTY_ELECTORAL_REGIONS_SWE_0")
  public List<SwedenCountyElectoralRegion> getCountyElectoralRegions() {
      return this.countyElectoralRegions;
  }
 
Example #17
Source File: SwedenElectionRegion.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the parties.
*
* @return the parties
*/
  @OneToMany(targetEntity = SwedenPoliticalParty.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "PARTIES_SWEDEN_ELECTION_REGI_0")
  public List<SwedenPoliticalParty> getParties() {
      return this.parties;
  }
 
Example #18
Source File: RechnungsPositionDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "rechnungs_pos_fk")
@OrderColumn(name = "index")
public List<KostZuweisungDO> getKostZuweisungen()
{
  return kostZuweisungen;
}
 
Example #19
Source File: JpaConfigHelper.java    From celerio with Apache License 2.0 5 votes vote down vote up
private static List<CascadeType> convertJpaCascade(List<Cascade> cascades) {
    if (cascades == null) {
        return null;
    }

    List<CascadeType> result = newArrayList();

    for (Cascade c : cascades) {
        if (c.getType().isJpaType()) {
            result.add(c.getType().asJpaType());
        }
    }

    return result;
}
 
Example #20
Source File: HRPlanningDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get the entries for this planned week.
 */
@OneToMany(cascade = { CascadeType.ALL}, fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "planning_fk")
@Cascade(value = org.hibernate.annotations.CascadeType.SAVE_UPDATE)
public List<HRPlanningEntryDO> getEntries()
{
  return this.entries;
}
 
Example #21
Source File: BusinessEntity.java    From juddi with Apache License 2.0 5 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "businessEntity")
@OrderBy
public List<Contact> getContacts() {
               if (this.contacts==null)
                       this.contacts = new ArrayList<Contact>();
	return this.contacts;
}
 
Example #22
Source File: IndicatorElement.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
* Gets the topics.
*
* @return the topics
*/
  @ManyToOne(targetEntity = Topics.class, cascade = {
      CascadeType.ALL
  })
  @JoinColumn(name = "TOPICS_INDICATOR_ELEMENT_HJID")
  public Topics getTopics() {
      return topics;
  }
 
Example #23
Source File: AuftragDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get the payment schedule entries for this object.
 */
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true, mappedBy = "auftrag")
@IndexColumn(name = "number", base = 1)
public List<PaymentScheduleDO> getPaymentSchedules()
{
  return this.paymentSchedules;
}
 
Example #24
Source File: Race.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
@OneToOne(cascade=CascadeType.ALL,fetch = FetchType.EAGER)  
@PrimaryKeyJoinColumn
public RaceAwards getAwards() {
    return awards;
}
 
Example #25
Source File: Node.java    From ankush with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Gets the monitors.
 * 
 * @return the monitors
 */
@OneToMany(mappedBy = "nodeId", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JsonIgnore
public List<NodeMonitoring> getMonitors() {
	return monitors;
}
 
Example #26
Source File: TSDemo.java    From jeewx with Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TSDemo")
public List<TSDemo> getTsDemos() {
	return tsDemos;
}
 
Example #27
Source File: TSDepart.java    From jeewx with Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TSPDepart")
public List<TSDepart> getTSDeparts() {
	return TSDeparts;
}
 
Example #28
Source File: Cluster.java    From ankush with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Gets the logs.
 * 
 * @return the logs
 */
@OneToMany(mappedBy = CLUSTER_ID, fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JsonIgnore
public List<Log> getLogs() {
	return logs;
}
 
Example #29
Source File: Resource.java    From zxl with Apache License 2.0 4 votes vote down vote up
@ManyToMany(fetch = FetchType.EAGER, targetEntity = Role.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JsonIgnore
@XmlTransient
public Set<Role> getRoles() {
	return roles;
}
 
Example #30
Source File: TSDepart.java    From jeecg with Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TSPDepart")
public List<TSDepart> getTSDeparts() {
	return TSDeparts;
}