protected FieldInfo buildFieldInfo(Field field) { FieldInfo info = new FieldInfo(); info.setName(field.getName()); info.setGenericType(field.getGenericType()); ManyToMany manyToMany = field.getAnnotation(ManyToMany.class); if (manyToMany != null) { info.setManyToManyMappedBy(manyToMany.mappedBy()); info.setManyToManyTargetEntity(manyToMany.targetEntity().getName()); } OneToMany oneToMany = field.getAnnotation(OneToMany.class); if (oneToMany != null) { info.setOneToManyMappedBy(oneToMany.mappedBy()); info.setOneToManyTargetEntity(oneToMany.targetEntity().getName()); } MapKey mapKey = field.getAnnotation(MapKey.class); if (mapKey != null) { info.setMapKey(mapKey.name()); } return info; }
@OneToMany(cascade=CascadeType.ALL) @JoinColumn(name="adesivo") @MapKey(name = "chave" ) public Map<String, CampoAdesivoVO> getCampos() { return campos; }
/** * @return the examOMRMetadataVO */ @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch=FetchType.EAGER) @JoinColumn(name = "fk_relatorio") @MapKey(name = "omrKey") @JazzProp(name="",ignore=true) @Fetch(FetchMode.SELECT) public Map<String, ExamOMRMetadataVO> getExamOMRMetadataVO() { return examOMRMetadataVO; }
@OneToMany(cascade = CascadeType.ALL, mappedBy = "bundle") @Fetch(value = FetchMode.SELECT) @MapKey(name = "locale") public Map<String, LanguageString> getStrings() { return strings; }
private void getMapKey(List<Annotation> annotationList, Element element) { Element subelement = element != null ? element.element( "map-key" ) : null; if ( subelement != null ) { AnnotationDescriptor ad = new AnnotationDescriptor( MapKey.class ); copyStringAttribute( ad, subelement, "name", false ); annotationList.add( AnnotationFactory.create( ad ) ); } }
@OneToMany(mappedBy="expedientTipus", cascade={CascadeType.ALL}, fetch=FetchType.EAGER) @Fetch(value = FetchMode.SUBSELECT) @MapKey(name = "any") @Sort(type = SortType.NATURAL) public SortedMap<Integer, SequenciaAny> getSequenciaAny() { return sequenciaAny; }
@OneToMany(mappedBy="expedientTipus", cascade={CascadeType.ALL}, fetch=FetchType.EAGER) @Fetch(value = FetchMode.SUBSELECT) @MapKey(name = "any") @Sort(type = SortType.NATURAL) public SortedMap<Integer, SequenciaDefaultAny> getSequenciaDefaultAny() { return sequenciaDefaultAny; }
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "jobData") @Fetch(FetchMode.SELECT) @BatchSize(size = 10) @MapKey(name = "jobId") @PrimaryKeyJoinColumn(name = "JOB_ID") public List<JobContent> getJobContent() { return jobContent; }
/** * @return the examOMRMetadataVO */ @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch=FetchType.EAGER) @JoinColumn(name = "fk_exam") @MapKey(name = "omrKey") @JazzProp(name="",ignore=true) @Fetch(FetchMode.SELECT) public Map<String, ExamOMRMetadataVO> getExamOMRMetadataVO() { return examOMRMetadataVO; }
@OneToMany( mappedBy="copy", cascade={ CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }, fetch=FetchType.LAZY ) @MapKey(name="plateNumber") @ToMany(hasNonconventionalMutation=true /*Maps not yet supported by automated model testing framework*/) @org.hibernate.annotations.Cascade(value={org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE}) public Map<Integer,Plate> getPlates() { return _plates; }
/** * The versioned reagents for this Well, accessible as a map, keyed on library * contents version number. A Well has only one reagent at a given point in * time. */ @OneToMany(mappedBy = "well", cascade = { CascadeType.ALL }, fetch = FetchType.LAZY) @ToMany(hasNonconventionalMutation=true) // Map-based collections not yet supported, tested in LibraryTest.testSmallCompoundLibraryAndrReagents @MapKey(name = "libraryContentsVersion") public Map<LibraryContentsVersion,Reagent> getReagents() { return _reagents; }
@OneToMany(mappedBy = "plateScreened", cascade = {}) @MapKey(name = "plateNumber") @ToMany(hasNonconventionalMutation = true /* we don't update this relationship in memory */) public Set<AssayPlate> getAssayPlates() { return _assayPlates; }
/** * Get the set of annotation values for this annotation type * @return the set of annotation values for this annotation type */ @OneToMany(fetch=FetchType.LAZY, cascade={ CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }, mappedBy="annotationType") @ToMany(hasNonconventionalMutation=true /* model unit tests don't handle Maps yet, tested in AnnotationTypeTest#testAnnotationValues */) @MapKey(name="reagent") @OptimisticLock(excluded=true) @org.hibernate.annotations.Cascade(value={org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE}) // removing, as this inconveniently forces us to access all reagents before looking for them in the map collection @org.hibernate.annotations.LazyCollection(LazyCollectionOption.EXTRA) public Map<Reagent,AnnotationValue> getAnnotationValues() { return _values; }
private boolean collectionNeedsAuditing(Object auditableObj, Object newValue, Object oldValue, String property) { try { String cn = CGLIBUtils.unEnhanceCBLIBClassName(auditableObj.getClass()); Method getter = getHibernateHelper().getConfiguration().getClassMapping(cn).getProperty(property) .getGetter(auditableObj.getClass()).getMethod(); if (getter.getAnnotation(MapKey.class) != null || getter.getAnnotation(MapKeyManyToMany.class) != null) { // this is some sort of map Map<?, ?> oldMap = (Map<?, ?>) oldValue; Map<?, ?> newMap = (Map<?, ?>) newValue; oldMap = oldMap == null ? Collections.emptyMap() : oldMap; newMap = newMap == null ? Collections.emptyMap() : newMap; return !equalsMap(oldMap, newMap); } else if (getter.getAnnotation(JoinTable.class) != null || getter.getAnnotation(JoinColumn.class) != null) { Collection<?> oldSet = (Collection<?>) oldValue; Collection<?> newSet = (Collection<?>) newValue; return !CollectionUtils.isEqualCollection((oldSet == null) ? Collections.emptySet() : oldSet, (newSet == null) ? Collections.emptySet() : newSet); } } catch (SecurityException e) { LOG.error(e.getMessage(), e); } return false; }
public void setMapKey(MapKey key) { if ( key != null ) { mapKeyPropertyName = key.name(); } }
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @MapKey(name = "name") @Filters({@Filter(name = "limitByNotDeleted")}) public Map<String, Attribute> getUserAttributes() { return userAttributes; }