Java Code Examples for javax.persistence.CascadeType

The following examples show how to use javax.persistence.CascadeType. These examples are extracted from open source projects. 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 Project: cia   Source File: DataElement.java    License: 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 2
Source Project: cia   Source File: DocumentStatusContainer.java    License: 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 3
Source Project: juddi   Source File: ReplicationConfiguration.java    License: 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 Project: cia   Source File: CommitteeProposalContainer.java    License: 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 5
Source Project: cia   Source File: PersonElement.java    License: 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 6
Source Project: hyperjaxb3   Source File: A.java    License: 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 7
Source Project: hyperjaxb3   Source File: A.java    License: 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 Project: cia   Source File: PersonAssignmentData.java    License: 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 Project: cia   Source File: BallotContainer.java    License: 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 Project: angularjs-addon   Source File: ProjectHelper.java    License: 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 Project: ankush   Source File: Node.java    License: 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 Project: celerio   Source File: JpaConfigHelper.java    License: 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
/**
 * 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 14
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 15
Source Project: cia   Source File: IndicatorElement.java    License: 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 16
Source Project: juddi   Source File: BusinessEntity.java    License: 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 17
/**
 * 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 18
Source Project: celerio   Source File: JpaConfigHelper.java    License: 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 19
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "rechnungs_pos_fk")
@OrderColumn(name = "index")
public List<KostZuweisungDO> getKostZuweisungen()
{
  return kostZuweisungen;
}
 
Example 20
Source Project: cia   Source File: SwedenElectionRegion.java    License: 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 21
Source Project: cia   Source File: SwedenCountyElectoralRegionContainer.java    License: 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 22
/**
* 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 23
Source Project: juddi   Source File: Publisher.java    License: Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "publisher")
@OrderBy
       public List<Signature> getSignatures() {
               return signatures;
       }
 
Example 24
Source Project: MiniWeChat-Server   Source File: User.java    License: MIT License 4 votes vote down vote up
@ManyToMany(targetEntity = Group.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "group_members", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "group_id"))
   public List<Group> getGroups() {
	return groups;
}
 
Example 25
Source Project: Exam-Online   Source File: Question.java    License: Apache License 2.0 4 votes vote down vote up
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name="question_id")
public List<Choice> getChoices() {
	return choices;
}
 
Example 26
Source Project: juddi   Source File: ObjectType.java    License: Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "objectType")
@OrderBy
public List<ObjectTypeContent> getContent() {
    return content;
}
 
Example 27
Source Project: Exam-Online   Source File: Resource.java    License: Apache License 2.0 4 votes vote down vote up
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "resource_id")
@OrderBy("good desc")
public List<ResourceComment> getComments() {
	return comments;
}
 
Example 28
Source Project: ankush   Source File: Cluster.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Gets the nodes.
 * 
 * @return the nodes
 */
@OneToMany(mappedBy = CLUSTER_ID, fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
@JsonIgnore
public Set<Node> getNodes() {
	return nodes;
}
 
Example 29
Source Project: ankush   Source File: Cluster.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @return the haServices
 */
@OneToMany(mappedBy = CLUSTER_ID, fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JsonIgnore
public List<Service> getServices() {
	return services;
}
 
Example 30
Source Project: jeewx   Source File: TSFunction.java    License: Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TSFunction")
public List<TSFunction> getTSFunctions() {
	return TSFunctions;
}