本文整理汇总了Java中javax.persistence.MapKey类的典型用法代码示例。如果您正苦于以下问题:Java MapKey类的具体用法?Java MapKey怎么用?Java MapKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapKey类属于javax.persistence包,在下文中一共展示了MapKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFieldInfo
import javax.persistence.MapKey; //导入依赖的package包/类
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;
}
示例2: getCampos
import javax.persistence.MapKey; //导入依赖的package包/类
@OneToMany(cascade=CascadeType.ALL)
@JoinColumn(name="adesivo")
@MapKey(name = "chave" )
public Map<String, CampoAdesivoVO> getCampos() {
return campos;
}
示例3: getExamOMRMetadataVO
import javax.persistence.MapKey; //导入依赖的package包/类
/**
* @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;
}
示例4: getStrings
import javax.persistence.MapKey; //导入依赖的package包/类
@OneToMany(cascade = CascadeType.ALL, mappedBy = "bundle")
@Fetch(value = FetchMode.SELECT)
@MapKey(name = "locale")
public Map<String, LanguageString> getStrings()
{
return strings;
}
示例5: getMapKey
import javax.persistence.MapKey; //导入依赖的package包/类
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 ) );
}
}
示例6: getSequenciaAny
import javax.persistence.MapKey; //导入依赖的package包/类
@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;
}
示例7: getSequenciaDefaultAny
import javax.persistence.MapKey; //导入依赖的package包/类
@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;
}
示例8: getJobContent
import javax.persistence.MapKey; //导入依赖的package包/类
@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;
}
示例9: getExamOMRMetadataVO
import javax.persistence.MapKey; //导入依赖的package包/类
/**
* @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;
}
示例10: getPlates
import javax.persistence.MapKey; //导入依赖的package包/类
@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;
}
示例11: getReagents
import javax.persistence.MapKey; //导入依赖的package包/类
/**
* 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;
}
示例12: getAssayPlates
import javax.persistence.MapKey; //导入依赖的package包/类
@OneToMany(mappedBy = "plateScreened", cascade = {})
@MapKey(name = "plateNumber")
@ToMany(hasNonconventionalMutation = true /* we don't update this relationship in memory */)
public Set<AssayPlate> getAssayPlates()
{
return _assayPlates;
}
示例13: getAnnotationValues
import javax.persistence.MapKey; //导入依赖的package包/类
/**
* 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;
}
示例14: collectionNeedsAuditing
import javax.persistence.MapKey; //导入依赖的package包/类
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;
}
示例15: setMapKey
import javax.persistence.MapKey; //导入依赖的package包/类
public void setMapKey(MapKey key) {
if ( key != null ) {
mapKeyPropertyName = key.name();
}
}