当前位置: 首页>>代码示例>>Java>>正文


Java ElementCollection类代码示例

本文整理汇总了Java中javax.persistence.ElementCollection的典型用法代码示例。如果您正苦于以下问题:Java ElementCollection类的具体用法?Java ElementCollection怎么用?Java ElementCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ElementCollection类属于javax.persistence包,在下文中一共展示了ElementCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAuthorities

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * 
 * @return
 */
@ElementCollection(targetClass=EAuthority.class,fetch=FetchType.EAGER)
@JoinTable(name = "grupo_autorities")
@Enumerated(EnumType.STRING)
@Fetch(FetchMode.SELECT)
public List<EAuthority> getAuthorities() {
	return authorities;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:12,代码来源:GrupoVO.java

示例2: getSerializeType

import javax.persistence.ElementCollection; //导入依赖的package包/类
@Override
public Optional<SerializeType> getSerializeType(BeanAttributeInformation attributeDesc) {
	Optional<OneToMany> oneToMany = attributeDesc.getAnnotation(OneToMany.class);
	if (oneToMany.isPresent()) {
		return toSerializeType(oneToMany.get().fetch());
	}
	Optional<ManyToOne> manyToOne = attributeDesc.getAnnotation(ManyToOne.class);
	if (manyToOne.isPresent()) {
		return toSerializeType(manyToOne.get().fetch());
	}
	Optional<ManyToMany> manyToMany = attributeDesc.getAnnotation(ManyToMany.class);
	if (manyToMany.isPresent()) {
		return toSerializeType(manyToMany.get().fetch());
	}
	Optional<ElementCollection> elementCollection = attributeDesc.getAnnotation(ElementCollection.class);
	if (elementCollection.isPresent()) {
		return toSerializeType(elementCollection.get().fetch());
	}
	return Optional.empty();
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:21,代码来源:JpaResourceFieldInformationProvider.java

示例3: bindCollectionSecondPass

import javax.persistence.ElementCollection; //导入依赖的package包/类
private static void bindCollectionSecondPass(
		Collection collValue,
		PersistentClass collectionEntity,
		Ejb3JoinColumn[] joinColumns,
		boolean cascadeDeleteEnabled,
		XProperty property,
		Mappings mappings) {
	try {
		BinderHelper.createSyntheticPropertyReference(
				joinColumns, collValue.getOwner(), collectionEntity, collValue, false, mappings
		);
	}
	catch (AnnotationException ex) {
		throw new AnnotationException( "Unable to map collection " + collectionEntity.getClassName() + "." + property.getName(), ex );
	}
	SimpleValue key = buildCollectionKey( collValue, joinColumns, cascadeDeleteEnabled, property, mappings );
	if ( property.isAnnotationPresent( ElementCollection.class ) && joinColumns.length > 0 ) {
		joinColumns[0].setJPA2ElementCollection( true );
	}
	TableBinder.bindFk( collValue.getOwner(), collectionEntity, joinColumns, key, false, mappings );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CollectionBinder.java

示例4: getLabels

import javax.persistence.ElementCollection; //导入依赖的package包/类
@Override
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "MCRCategoryLabels",
    joinColumns = @JoinColumn(name = "category"),
    uniqueConstraints = {
        @UniqueConstraint(columnNames = { "category", "lang" }) })
public Set<MCRLabel> getLabels() {
    return super.getLabels();
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:10,代码来源:MCRCategoryImpl.java

示例5: determineDeleteInBatchSupported

import javax.persistence.ElementCollection; //导入依赖的package包/类
private boolean determineDeleteInBatchSupported(final Class<?> genericType) {
    final MutableBoolean deleteInBatchSupported = new MutableBoolean(true);
    Reflections.doWithFields(genericType, new FieldCallback() {
        @Override
        public void doWith(final Field field) {
            if (!deleteInBatchSupported.getValue()) {
                return;
            } else if (Reflections.getAnnotation(field, ElementCollection.class) != null) {
                //element collections are mapped as separate tables, thus the values would cause a foreign key constraint violation
                deleteInBatchSupported.setValue(false);
            } else if (Reflections.getAnnotation(field, Embedded.class) != null) {
                //check embedded types for the same constraints
                if (!determineDeleteInBatchSupported(field.getType())) {
                    deleteInBatchSupported.setValue(false);
                }
            }
        }
    });
    return deleteInBatchSupported.getValue();
}
 
开发者ID:subes,项目名称:invesdwin-context-persistence,代码行数:21,代码来源:ACustomIdDao.java

示例6: getScreensaverUserRoles

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * Get the set of user roles that this user belongs to. Do not modify the
 * contents of the returned collection: use
 * {@link #addScreensaverUserRole(ScreensaverUserRole)} or
 * {@link #removeScreensaverUserRole(ScreensaverUserRole)} instead.
 * 
 * @return the set of user roles that this user belongs to
 */
@ElementCollection
@edu.harvard.med.screensaver.model.annotations.ElementCollection(hasNonconventionalMutation = true /*
                                                                                                    * valid roles
                                                                                                    * depend upon
                                                                                                    * concrete entity
                                                                                                    * type
                                                                                                    */)
@Column(name = "screensaverUserRole", nullable = false)
@JoinTable(name = "screensaverUserRole", joinColumns = @JoinColumn(name = "screensaverUserId"))
@org.hibernate.annotations.Type(type = "edu.harvard.med.screensaver.model.users.ScreensaverUserRole$UserType")
@org.hibernate.annotations.ForeignKey(name = "fk_screensaver_user_role_type_to_screensaver_user")
public Set<ScreensaverUserRole> getScreensaverUserRoles()
{
  return _roles;
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:24,代码来源:ScreensaverUser.java

示例7: getElementCollection

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * As per sections 12.2.3.23.9, 12.2.4.8.9 and 12.2.5.3.6 of the JPA 2.0
 * specification, the element-collection subelement completely overrides the
 * mapping for the specified field or property.  Thus, any methods which
 * might in some contexts merge with annotations must not do so in this
 * context.
 */
private void getElementCollection(List<Annotation> annotationList, XMLContext.Default defaults) {
	for ( Element element : elementsForProperty ) {
		if ( "element-collection".equals( element.getName() ) ) {
			AnnotationDescriptor ad = new AnnotationDescriptor( ElementCollection.class );
			addTargetClass( element, ad, "target-class", defaults );
			getFetchType( ad, element );
			getOrderBy( annotationList, element );
			getOrderColumn( annotationList, element );
			getMapKey( annotationList, element );
			getMapKeyClass( annotationList, element, defaults );
			getMapKeyTemporal( annotationList, element );
			getMapKeyEnumerated( annotationList, element );
			getMapKeyColumn( annotationList, element );
			buildMapKeyJoinColumns( annotationList, element );
			Annotation annotation = getColumn( element.element( "column" ), false, element );
			addIfNotNull( annotationList, annotation );
			getTemporal( annotationList, element );
			getEnumerated( annotationList, element );
			getLob( annotationList, element );
			//Both map-key-attribute-overrides and attribute-overrides
			//translate into AttributeOverride annotations, which need
			//need to be wrapped in the same AttributeOverrides annotation.
			List<AttributeOverride> attributes = new ArrayList<AttributeOverride>();
			attributes.addAll( buildAttributeOverrides( element, "map-key-attribute-override" ) );
			attributes.addAll( buildAttributeOverrides( element, "attribute-override" ) );
			annotation = mergeAttributeOverrides( defaults, attributes, false );
			addIfNotNull( annotationList, annotation );
			annotation = getAssociationOverrides( element, defaults, false );
			addIfNotNull( annotationList, annotation );
			getCollectionTable( annotationList, element, defaults );
			annotationList.add( AnnotationFactory.create( ad ) );
			getAccessType( annotationList, element );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:JPAOverriddenAnnotationReader.java

示例8: isMappedCollection

import javax.persistence.ElementCollection; //导入依赖的package包/类
@Override
public boolean isMappedCollection(CtField field) {
    try {
        return (field.getAnnotation(OneToMany.class) != null ||
                field.getAnnotation(ManyToMany.class) != null ||
                field.getAnnotation(ElementCollection.class) != null);
    }
    catch (ClassNotFoundException e) {
        return false;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:EnhancementTask.java

示例9: getParameters

import javax.persistence.ElementCollection; //导入依赖的package包/类
@ElementCollection
@MapKeyColumn(name = "parameters_idx")
@Column(name = "parameters_elt")
@CollectionTable(name = "info_parameters")
public Map<String, String> getParameters() {
    return parameters;
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:8,代码来源:Info.java

示例10: getAttributes

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * @return the attributes
 */
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "MCRUserAttr",
    joinColumns = @JoinColumn(name = "id"),
    indexes = { @Index(name = "MCRUserAttributes", columnList = "name, value"),
        @Index(name = "MCRUserValues", columnList = "value") })
@MapKeyColumn(name = "name", length = 128)
@Column(name = "value", length = 255)
public Map<String, String> getAttributes() {
    return attributes;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:14,代码来源:MCRUser.java

示例11: getParameters

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * Returns all set parameters of the job.
 * 
 * @return the job parameters
 */
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "MCRJobParameter", joinColumns = @JoinColumn(name = "jobID"))
@MapKeyColumn(name = "paramKey", length = 128)
@Column(name = "paramValue", length = 255)
public Map<String, String> getParameters() {
    return parameters;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:13,代码来源:MCRJob.java

示例12: getOptions

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * 获取可选项
 * 
 * @return 可选项
 */
@JsonProperty
@NotEmpty
@ElementCollection
@CollectionTable(name = "xx_attribute_option")
public List<String> getOptions() {
	return options;
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:13,代码来源:Attribute.java

示例13: getAttributes

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * 获取属性
 * 
 * @return 属性
 */
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "xx_plugin_config_attribute")
@MapKeyColumn(name = "name", length = 100)
public Map<String, String> getAttributes() {
	return attributes;
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:12,代码来源:PluginConfig.java

示例14: getProductImages

import javax.persistence.ElementCollection; //导入依赖的package包/类
/**
 * 获取商品图片
 * 
 * @return 商品图片
 */
@Valid
@ElementCollection
@CollectionTable(name = "xx_product_product_image")
public List<ProductImage> getProductImages() {
	return productImages;
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:12,代码来源:Product.java

示例15: getAuthorities

import javax.persistence.ElementCollection; //导入依赖的package包/类
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "UserPrincipal_Authority", joinColumns = {
		@JoinColumn(referencedColumnName = "Id", name = "UserId") })
@Override
public Set<UserAuthority> getAuthorities() {
	return this.authorities;
}
 
开发者ID:shilongdai,项目名称:bookManager,代码行数:8,代码来源:UserPrincipal.java


注:本文中的javax.persistence.ElementCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。