Java Code Examples for javax.persistence.CascadeType#REMOVE

The following examples show how to use javax.persistence.CascadeType#REMOVE . 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: Race.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@OneToMany(mappedBy="race",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER)
@OrderBy("split_seq_number")
@Fetch(FetchMode.SELECT)
public List<Split> getSplits() {
    return raceSplitList;
    //return raceSplits.sorted((Split o1, Split o2) -> o1.getPosition().compareTo(o2.getPosition()));
}
 
Example 2
Source File: ReflectiveClone.java    From development with Apache License 2.0 5 votes vote down vote up
private static boolean needsToCascade(Field field) {
    Class<?> fieldtype = field.getType();
    if (!DomainObject.class.isAssignableFrom(fieldtype))
        return false;
    Annotation ann;
    CascadeType[] cascades = null;
    ann = field.getAnnotation(OneToOne.class);
    if (ann != null) {
        cascades = ((OneToOne) ann).cascade();
    } else {
        ann = field.getAnnotation(OneToMany.class);
        if (ann != null) {
            cascades = ((OneToMany) ann).cascade();
        } else {
            ann = field.getAnnotation(ManyToOne.class);
            if (ann != null) {
                cascades = ((ManyToOne) ann).cascade();
            } else {
                ann = field.getAnnotation(ManyToMany.class);
                if (ann != null) {
                    cascades = ((ManyToMany) ann).cascade();
                }
            }
        }
    }
    if (cascades == null)
        return false;
    for (CascadeType cas : cascades) {
        if ((cas == CascadeType.ALL) || (cas == CascadeType.MERGE)
                || (cas == CascadeType.PERSIST)
                || (cas == CascadeType.REMOVE)) {
            return true;
        }
    }
    return false;
}
 
Example 3
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 4
Source File: RaceAwards.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
@ElementCollection(fetch = FetchType.EAGER)
@OneToMany(mappedBy="raceAward",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER)
@Fetch(FetchMode.SELECT)
@OrderColumn(name = "category_priority")
public List<AwardCategory> getAwardCategories(){
    return awardCategories;
}
 
Example 5
Source File: Person.java    From requery with Apache License 2.0 4 votes vote down vote up
@OneToMany(mappedBy = "owner", cascade =
        {CascadeType.REMOVE, CascadeType.PERSIST})
MutableResult<Phone> getPhoneNumbers();
 
Example 6
Source File: Cluster.java    From ankush with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Gets the events.
 * 
 * @return the events
 */
@OneToMany(mappedBy = CLUSTER_ID, fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JsonIgnore
public List<Event> getEvents() {
	return events;
}
 
Example 7
Source File: Cluster.java    From ankush with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Gets the configurations.
 * 
 * @return the configurations
 */
@OneToMany(mappedBy = CLUSTER_ID, fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JsonIgnore
public List<Configuration> getConfigurations() {
	return configurations;
}
 
Example 8
Source File: Cluster.java    From ankush with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @return the operations
 */
@OneToMany(mappedBy = CLUSTER_ID, fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JsonIgnore
public List<Operation> getOperations() {
	return operations;
}
 
Example 9
Source File: Cluster.java    From ankush with 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<HAService> getHaServices() {
	return haServices;
}
 
Example 10
Source File: Cluster.java    From ankush with 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 11
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 12
Source File: Node.java    From ankush with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @return the configuration
 */
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@JoinColumns({ @JoinColumn(name = "node", referencedColumnName = "publicIp") })
public List<Service> getServices() {
	return services;
}
 
Example 13
Source File: Cluster.java    From ankush with 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 14
Source File: CgFormHeadEntity.java    From jeewx with Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade=CascadeType.REMOVE,mappedBy="table")
@OrderBy(clause="orderNum asc")
public List<CgFormFieldEntity> getColumns() {
	return columns;
}
 
Example 15
Source File: CgFormHeadEntity.java    From jeecg with Apache License 2.0 4 votes vote down vote up
@OneToMany(cascade=CascadeType.REMOVE,mappedBy="table")
public List<CgFormIndexEntity> getIndexes() {
	return indexes;
}
 
Example 16
Source File: CourseEntity.java    From jeewx with Apache License 2.0 4 votes vote down vote up
@OneToMany(mappedBy="course",cascade=CascadeType.REMOVE)
public List<StudentEntity> getStudents() {
	return students;
}
 
Example 17
Source File: CourseEntity.java    From jeewx with Apache License 2.0 4 votes vote down vote up
/**
 *方法: 取得java.lang.String
 *@return: java.lang.String  老师主键
 */
@ManyToOne(cascade=CascadeType.REMOVE)
public TeacherEntity getTeacher() {
	return teacher;
}
 
Example 18
Source File: RaceReport.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
@OneToMany(mappedBy="raceReport",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.LAZY)
@Fetch(FetchMode.SELECT)
public List<RaceOutputTarget> getRaceOutputTargets() {
    return raceOutputTargetList;
}
 
Example 19
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 20
Source File: Race.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
@OneToMany(mappedBy="race",cascade={CascadeType.PERSIST, CascadeType.REMOVE},fetch = FetchType.EAGER)
@Fetch(FetchMode.SELECT)
public List<Wave> getWaves() {
    return raceWavesList;
}