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


Java OneToOne.mappedBy方法代码示例

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


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

示例1: getMappedBy

import javax.persistence.OneToOne; //导入方法依赖的package包/类
private String getMappedBy(MetaAttribute attr) {
	ManyToMany manyManyAnnotation = attr.getAnnotation(ManyToMany.class);
	OneToMany oneManyAnnotation = attr.getAnnotation(OneToMany.class);
	OneToOne oneOneAnnotation = attr.getAnnotation(OneToOne.class);
	String mappedBy = null;
	if (manyManyAnnotation != null) {
		mappedBy = manyManyAnnotation.mappedBy();
	}
	if (oneManyAnnotation != null) {
		mappedBy = oneManyAnnotation.mappedBy();
	}
	if (oneOneAnnotation != null) {
		mappedBy = oneOneAnnotation.mappedBy();
	}

	if (mappedBy != null && mappedBy.length() == 0) {
		mappedBy = null;
	}
	return mappedBy;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:21,代码来源:JpaMetaFilter.java

示例2: buildDefaultJoinColumnsForXToOne

import javax.persistence.OneToOne; //导入方法依赖的package包/类
Ejb3JoinColumn[] buildDefaultJoinColumnsForXToOne(XProperty property, PropertyData inferredData) {
	Ejb3JoinColumn[] joinColumns;
	JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
	if ( joinTableAnn != null ) {
		joinColumns = Ejb3JoinColumn.buildJoinColumns(
				joinTableAnn.inverseJoinColumns(), null, entityBinder.getSecondaryTables(),
				propertyHolder, inferredData.getPropertyName(), mappings
		);
		if ( StringHelper.isEmpty( joinTableAnn.name() ) ) {
			throw new AnnotationException(
					"JoinTable.name() on a @ToOne association has to be explicit: "
							+ BinderHelper.getPath( propertyHolder, inferredData )
			);
		}
	}
	else {
		OneToOne oneToOneAnn = property.getAnnotation( OneToOne.class );
		String mappedBy = oneToOneAnn != null ?
				oneToOneAnn.mappedBy() :
				null;
		joinColumns = Ejb3JoinColumn.buildJoinColumns(
				null,
				mappedBy, entityBinder.getSecondaryTables(),
				propertyHolder, inferredData.getPropertyName(), mappings
		);
	}
	return joinColumns;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:ColumnsBuilder.java

示例3: MappingInformation

import javax.persistence.OneToOne; //导入方法依赖的package包/类
MappingInformation(final AttributeAccessor attribute) {
	final OneToOne oneToOne = attribute.getAnnotation(OneToOne.class);
	final NotNull notNull = attribute.getAnnotation(NotNull.class);
	if (oneToOne != null) {
		this.optional = oneToOne.optional() && notNull == null;
		this.mappedBy = oneToOne.mappedBy();
		this.anyMetaColumn = null;
	} else {
		this.mappedBy = "";
		final ManyToOne manyToOne = attribute.getAnnotation(ManyToOne.class);
		if (manyToOne != null) {
			this.optional = manyToOne.optional() && notNull == null;
			this.anyMetaColumn = null;
		} else {
			final Any any = attribute.getAnnotation(Any.class);
			if (any != null) {
				this.optional = any.optional() && notNull == null;
				this.anyMetaColumn = any.metaColumn().name();
			} else {
				final ManyToAny manyToAny = attribute.getAnnotation(ManyToAny.class);
				if (manyToAny == null) {
					throw new IllegalArgumentException(
							attribute + " is neither declared as OneToOne nor ManyToOne");
				}
				this.optional = notNull == null;
				this.anyMetaColumn = manyToAny.metaColumn().name();
			}
		}
	}
}
 
开发者ID:liefke,项目名称:org.fastnate,代码行数:31,代码来源:EntityProperty.java


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