List of usage examples for javax.persistence CascadeType ALL
CascadeType ALL
To view the source code for javax.persistence CascadeType ALL.
Click Source Link
From source file:com.hmsinc.epicenter.model.surveillance.Anomaly.java
/** * @return the task//w w w .j av a2 s . com */ @ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY) @JoinColumn(name = "ID_SURVEILLANCE_TASK", unique = false, nullable = false, insertable = true, updatable = true) @org.hibernate.annotations.ForeignKey(name = "FK_ANOMALY_1") public SurveillanceTask getTask() { return task; }
From source file:uk.nhs.cfh.dsp.srth.information.model.impl.om.ehr.EHRImpl.java
/** * Gets the interventions.//w ww . j a v a 2 s.com * * @return the interventions */ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, targetEntity = InterventionEventEntry.class) @JoinTable(name = "EHR_INTERVENTIONS", joinColumns = @JoinColumn(name = PATIENT_ID), inverseJoinColumns = @JoinColumn(name = "intervention_id")) @ForeignKey(name = "FK_EHR_INTV", inverseName = "FK_INTV_EHR") public Set<BoundClinicalEventEntry> getInterventions() { return interventions; }
From source file:com.hmsinc.epicenter.model.health.Patient.java
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "patient") @Sort(type = SortType.NATURAL)//from w ww . j a va 2 s. c om public SortedSet<Interaction> getInteractions() { return this.interactions; }
From source file:org.batoo.jpa.core.impl.model.mapping.AssociationMappingImpl.java
/** * @param parent/* w w w . ja v a 2 s . c o m*/ * the parent mapping * @param metadata * the metadata * @param attribute * the attribute * * @since 2.0.0 */ public AssociationMappingImpl(AbstractParentMapping<?, Z> parent, AssociationAttributeMetadata metadata, AttributeImpl<? super Z, X> attribute) { super(parent, attribute, attribute.getJavaType(), attribute.getName()); if ((metadata instanceof MappableAssociationAttributeMetadata) && StringUtils.isNotBlank(((MappableAssociationAttributeMetadata) metadata).getMappedBy())) { this.mappedBy = ((MappableAssociationAttributeMetadata) metadata).getMappedBy(); } else { this.mappedBy = null; } this.eager = attribute.isCollection() || (this.mappedBy == null) ? metadata.getFetchType() == FetchType.EAGER : true; this.maxFetchDepth = metadata.getMaxFetchDepth(); this.fetchStrategy = metadata.getFetchStrategy(); if (metadata instanceof OrphanableAssociationAttributeMetadata) { this.removesOrphans = ((OrphanableAssociationAttributeMetadata) metadata).removesOrphans(); } else { this.removesOrphans = false; } this.cascadesDetach = metadata.getCascades().contains(CascadeType.ALL) || metadata.getCascades().contains(CascadeType.DETACH); this.cascadesMerge = metadata.getCascades().contains(CascadeType.ALL) || metadata.getCascades().contains(CascadeType.MERGE); this.cascadesPersist = metadata.getCascades().contains(CascadeType.ALL) || metadata.getCascades().contains(CascadeType.PERSIST); this.cascadesRefresh = metadata.getCascades().contains(CascadeType.ALL) || metadata.getCascades().contains(CascadeType.REFRESH); this.cascadesRemove = metadata.getCascades().contains(CascadeType.ALL) || metadata.getCascades().contains(CascadeType.REMOVE); }
From source file:py.una.pol.karaku.dao.entity.interceptors.InterceptorHandler.java
/** * Intercepta un atributo de un bean especifico. * // ww w.ja v a2s.c o m * <p> * Reglas: * <ol> * <li>Si el item es un atributo normal, invocar a su respectivo * interceptor. * </p> * <li>Si es una coleccin, y tiene tiene la anotacin {@link OneToMany}, y * su {@link CascadeType} es {@link CascadeType#ALL}, entonces se propaga la * intercepcin a los miembros de la coleccin. </p> * * @param op * Operacin actual. * @param field * campo sobre el cual se esta ejecutando. * @param bean * objeto que esta siendo interceptado. */ private void intercept(@Nonnull Operation op, @Nonnull Field field, @Nonnull Object bean) { if (field.getAnnotation(OneToMany.class) != null) { OneToMany otm = field.getAnnotation(OneToMany.class); CascadeType[] cascade = otm.cascade(); if (cascade != null && ListHelper.contains(cascade, CascadeType.ALL)) { field.setAccessible(true); Collection<?> c = (Collection<?>) ReflectionUtils.getField(field, bean); if (Hibernate.isInitialized(c) && ListHelper.hasElements(c)) { for (Object o : c) { this.intercept(op, o); } } } return; } field.setAccessible(true); Class<?> type = field.getType(); Set<Interceptor> typeInterceptors = addAll(byType.get(void.class), byType.get(type)); Annotation[] annons = field.getAnnotations(); Set<Interceptor> annonInterceptors = new HashSet<Interceptor>(); if (byAnnotation.get(void.class) != null) { annonInterceptors.addAll(byAnnotation.get(void.class)); } for (Annotation an : annons) { if (byAnnotation.get(an.annotationType()) != null) { annonInterceptors.addAll(byAnnotation.get(an.annotationType())); } } typeInterceptors.retainAll(annonInterceptors); for (Interceptor bi : typeInterceptors) { if (this.isAssignable(field) && bi.interceptable(op, field, bean)) { bi.intercept(op, field, bean); } } }
From source file:com.anite.zebra.hivemind.om.defs.ZebraProcessDefinition.java
@OneToMany(targetEntity = ZebraRoutingDefinition.class, cascade = CascadeType.ALL) @JoinTable(name = "processDefinitionRoutings", joinColumns = { @JoinColumn(name = "processDefinitionId") }, inverseJoinColumns = @JoinColumn(name = "routingDefinitionId")) public Set getRoutingDefinitions() { return this.routingDefinitions; }
From source file:gov.nih.nci.protexpress.domain.protocol.ProtocolApplication.java
/** * Gets the inputs./*from w ww.j a v a 2 s. c om*/ * * @return the inputs. */ @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "protapp_inputs", joinColumns = { @JoinColumn(name = "protapp_id") }, inverseJoinColumns = { @JoinColumn(name = "input_id") }) public List<InputOutputObject> getInputs() { return inputs; }
From source file:ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE.java
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "vocabularyInternal") @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) private Set<VocabularyTermPE> getVocabularyTerms() { return terms; }
From source file:org.oregonask.entities.Program.java
@OneToMany(cascade = { CascadeType.ALL }) @JoinColumn(name = "PROGRAM_ID") @JsonProperty("PROGRAM_INFO") public Set<ProgramInfo> getPrograminfo() { return ProgramInfo; }
From source file:no.abmu.questionnaire.domain.metadata.FieldImpl.java
@ManyToOne(cascade = CascadeType.ALL) public FieldType getType() { return type; }