當前位置: 首頁>>代碼示例>>Java>>正文


Java PrimaryKeyJoinColumn類代碼示例

本文整理匯總了Java中javax.persistence.PrimaryKeyJoinColumn的典型用法代碼示例。如果您正苦於以下問題:Java PrimaryKeyJoinColumn類的具體用法?Java PrimaryKeyJoinColumn怎麽用?Java PrimaryKeyJoinColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PrimaryKeyJoinColumn類屬於javax.persistence包,在下文中一共展示了PrimaryKeyJoinColumn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPrimaryKeyJoinColumns

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
/**
 * @param mergeWithAnnotations Whether to use Java annotations for this
 * element, if present and not disabled by the XMLContext defaults.
 * In some contexts (such as an association mapping) merging with
 * annotations is never allowed.
 */
private PrimaryKeyJoinColumns getPrimaryKeyJoinColumns(Element element, XMLContext.Default defaults, boolean mergeWithAnnotations) {
	PrimaryKeyJoinColumn[] columns = buildPrimaryKeyJoinColumns( element );
	if ( mergeWithAnnotations ) {
		if ( columns.length == 0 && defaults.canUseJavaAnnotations() ) {
			PrimaryKeyJoinColumn annotation = getPhysicalAnnotation( PrimaryKeyJoinColumn.class );
			if ( annotation != null ) {
				columns = new PrimaryKeyJoinColumn[] { annotation };
			}
			else {
				PrimaryKeyJoinColumns annotations = getPhysicalAnnotation( PrimaryKeyJoinColumns.class );
				columns = annotations != null ? annotations.value() : columns;
			}
		}
	}
	if ( columns.length > 0 ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( PrimaryKeyJoinColumns.class );
		ad.setValue( "value", columns );
		return AnnotationFactory.create( ad );
	}
	else {
		return null;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:30,代碼來源:JPAOverriddenAnnotationReader.java

示例2: buildPrimaryKeyJoinColumns

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private PrimaryKeyJoinColumn[] buildPrimaryKeyJoinColumns(Element element) {
	if ( element == null ) {
		return new PrimaryKeyJoinColumn[] { };
	}
	List pkJoinColumnElementList = element.elements( "primary-key-join-column" );
	PrimaryKeyJoinColumn[] pkJoinColumns = new PrimaryKeyJoinColumn[pkJoinColumnElementList.size()];
	int index = 0;
	Iterator pkIt = pkJoinColumnElementList.listIterator();
	while ( pkIt.hasNext() ) {
		Element subelement = (Element) pkIt.next();
		AnnotationDescriptor pkAnn = new AnnotationDescriptor( PrimaryKeyJoinColumn.class );
		copyStringAttribute( pkAnn, subelement, "name", false );
		copyStringAttribute( pkAnn, subelement, "referenced-column-name", false );
		copyStringAttribute( pkAnn, subelement, "column-definition", false );
		pkJoinColumns[index++] = AnnotationFactory.create( pkAnn );
	}
	return pkJoinColumns;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:19,代碼來源:JPAOverriddenAnnotationReader.java

示例3: buildPrimaryKeyJoinColumn

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private void buildPrimaryKeyJoinColumn() {
	if (this.joinedParentClass.getIdProperty() instanceof SingularProperty) {
		final PrimaryKeyJoinColumn pkColumn = this.entityClass.getAnnotation(PrimaryKeyJoinColumn.class);
		final String columnName;
		if (pkColumn == null || StringUtils.isEmpty(pkColumn.name())) {
			columnName = ((SingularProperty<? super E, ?>) this.joinedParentClass.getIdProperty()).getColumn()
					.getName();
		} else {
			columnName = pkColumn.name();
		}
		this.primaryKeyJoinColumn = this.table.resolveColumn(columnName);
	} else {
		throw new IllegalArgumentException(
				"JOINED inheritance strategy is currently only supported with singular ID properties.");
	}
}
 
開發者ID:liefke,項目名稱:org.fastnate,代碼行數:17,代碼來源:EntityClass.java

示例4: getPrimaryKeyJoinColumns

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
public static PrimaryKeyJoinColumn[] getPrimaryKeyJoinColumns(final Class<?> clazz) {
    final PrimaryKeyJoinColumn pkjc = clazz.getAnnotation(PrimaryKeyJoinColumn.class);
    if (pkjc != null) {
        return new PrimaryKeyJoinColumn[]{pkjc};
    }

    final PrimaryKeyJoinColumns pkjcs = clazz.getAnnotation(PrimaryKeyJoinColumns.class);
    if (pkjcs != null) {
        return pkjcs.value();
    }

    return null;
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:14,代碼來源:DbUtil.java

示例5: addPrimaryKeyJoinColumns

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
protected static void addPrimaryKeyJoinColumns(final StringBuilder sql, final String fromTable, final String toTable, final String joinType, final PrimaryKeyJoinColumn[]
        pkjcs) {
    if ("right".equalsIgnoreCase(joinType)) {
        sql.append(" RIGHT JOIN ").append(toTable).append(" ON ");
    } else if ("left".equalsIgnoreCase(joinType)) {
        sql.append(" LEFT JOIN ").append(toTable).append(" ON ");
    } else {
        sql.append(" INNER JOIN ").append(toTable).append(" ON ");
    }
    for (final PrimaryKeyJoinColumn pkjc : pkjcs) {
        sql.append(fromTable).append(".").append(pkjc.name());
        final String refColumn = DbUtil.getReferenceColumn(pkjc);
        sql.append("=").append(toTable).append(".").append(refColumn).append(" ");
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:16,代碼來源:SqlGenerator.java

示例6: getJobContent

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的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;
}
 
開發者ID:ow2-proactive,項目名稱:scheduling,代碼行數:9,代碼來源:JobData.java

示例7: getPrimaryKeyJoinColumns

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
public static PrimaryKeyJoinColumn[] getPrimaryKeyJoinColumns(Class<?> clazz) {
    PrimaryKeyJoinColumn pkjc = clazz.getAnnotation(PrimaryKeyJoinColumn.class);
    if (pkjc != null) {
        return new PrimaryKeyJoinColumn[] {pkjc};
    }

    PrimaryKeyJoinColumns pkjcs = clazz.getAnnotation(PrimaryKeyJoinColumns.class);
    if (pkjcs != null) {
        return pkjcs.value();
    }

    return null;
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:14,代碼來源:DbUtil.java

示例8: addPrimaryKeyJoinColumns

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
protected static void addPrimaryKeyJoinColumns(StringBuilder sql, String fromTable, String toTable, String joinType, PrimaryKeyJoinColumn[] pkjcs) {
    if ("right".equalsIgnoreCase(joinType)) {
        sql.append(" RIGHT JOIN ").append(toTable).append(" ON ");
    } else if ("left".equalsIgnoreCase(joinType)) {
        sql.append(" LEFT JOIN ").append(toTable).append(" ON ");
    } else {
        sql.append(" INNER JOIN ").append(toTable).append(" ON ");
    }
    for (PrimaryKeyJoinColumn pkjc : pkjcs) {
        sql.append(fromTable).append(".").append(pkjc.name());
        String refColumn = DbUtil.getReferenceColumn(pkjc);
        sql.append("=").append(toTable).append(".").append(refColumn).append(" ");
    }
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:15,代碼來源:SqlGenerator.java

示例9: createPrimaryColumnsToSecondaryTable

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private void createPrimaryColumnsToSecondaryTable(Object uncastedColumn, PropertyHolder propertyHolder, Join join) {
	Ejb3JoinColumn[] ejb3JoinColumns;
	PrimaryKeyJoinColumn[] pkColumnsAnn = null;
	JoinColumn[] joinColumnsAnn = null;
	if ( uncastedColumn instanceof PrimaryKeyJoinColumn[] ) {
		pkColumnsAnn = (PrimaryKeyJoinColumn[]) uncastedColumn;
	}
	if ( uncastedColumn instanceof JoinColumn[] ) {
		joinColumnsAnn = (JoinColumn[]) uncastedColumn;
	}
	if ( pkColumnsAnn == null && joinColumnsAnn == null ) {
		ejb3JoinColumns = new Ejb3JoinColumn[1];
		ejb3JoinColumns[0] = Ejb3JoinColumn.buildJoinColumn(
				null,
				null,
				persistentClass.getIdentifier(),
				secondaryTables,
				propertyHolder, mappings
		);
	}
	else {
		int nbrOfJoinColumns = pkColumnsAnn != null ?
				pkColumnsAnn.length :
				joinColumnsAnn.length;
		if ( nbrOfJoinColumns == 0 ) {
			ejb3JoinColumns = new Ejb3JoinColumn[1];
			ejb3JoinColumns[0] = Ejb3JoinColumn.buildJoinColumn(
					null,
					null,
					persistentClass.getIdentifier(),
					secondaryTables,
					propertyHolder, mappings
			);
		}
		else {
			ejb3JoinColumns = new Ejb3JoinColumn[nbrOfJoinColumns];
			if ( pkColumnsAnn != null ) {
				for (int colIndex = 0; colIndex < nbrOfJoinColumns; colIndex++) {
					ejb3JoinColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
							pkColumnsAnn[colIndex],
							null,
							persistentClass.getIdentifier(),
							secondaryTables,
							propertyHolder, mappings
					);
				}
			}
			else {
				for (int colIndex = 0; colIndex < nbrOfJoinColumns; colIndex++) {
					ejb3JoinColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
							null,
							joinColumnsAnn[colIndex],
							persistentClass.getIdentifier(),
							secondaryTables,
							propertyHolder, mappings
					);
				}
			}
		}
	}

	for (Ejb3JoinColumn joinColumn : ejb3JoinColumns) {
		joinColumn.forceNotNull();
	}
	bindJoinToPersistentClass( join, ejb3JoinColumns, mappings );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:67,代碼來源:EntityBinder.java

示例10: isIdField

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
private static boolean isIdField(final Field field) {
    return field.isAnnotationPresent(Id.class) || field.isAnnotationPresent(PrimaryKeyJoinColumn.class);
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-web,代碼行數:4,代碼來源:JpaModelTest.java

示例11: getCustomerAccount

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public CustomerAccount getCustomerAccount() {
	return this.customerAccount;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-MVC-Blueprints,代碼行數:6,代碼來源:Login.java

示例12: getCustomerAccount

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public CustomerAccount getCustomerAccount() {
	return this.customerAccount;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-MVC-Blueprints,代碼行數:7,代碼來源:Login.java

示例13: getInvoice

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public Invoice getInvoice() {
	return this.invoice;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-MVC-Blueprints,代碼行數:6,代碼來源:InvoicedProducts.java

示例14: getUser

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public User getUser() {
	return this.user;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-MVC-Blueprints,代碼行數:6,代碼來源:Login.java

示例15: getTblstudents

import javax.persistence.PrimaryKeyJoinColumn; //導入依賴的package包/類
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public Tblstudents getTblstudents() {
	return this.tblstudents;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-MVC-Blueprints,代碼行數:6,代碼來源:Tblgpa.java


注:本文中的javax.persistence.PrimaryKeyJoinColumn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。