當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。