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


Java JoinColumn類代碼示例

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


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

示例1: getCollectionTable

import javax.persistence.JoinColumn; //導入依賴的package包/類
private void getCollectionTable(List<Annotation> annotationList, Element element, XMLContext.Default defaults) {
	Element subelement = element != null ? element.element( "collection-table" ) : null;
	if ( subelement != null ) {
		AnnotationDescriptor annotation = new AnnotationDescriptor( CollectionTable.class );
		copyStringAttribute( annotation, subelement, "name", false );
		copyStringAttribute( annotation, subelement, "catalog", false );
		if ( StringHelper.isNotEmpty( defaults.getCatalog() )
				&& StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) {
			annotation.setValue( "catalog", defaults.getCatalog() );
		}
		copyStringAttribute( annotation, subelement, "schema", false );
		if ( StringHelper.isNotEmpty( defaults.getSchema() )
				&& StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) {
			annotation.setValue( "schema", defaults.getSchema() );
		}
		JoinColumn[] joinColumns = getJoinColumns( subelement, false );
		if ( joinColumns.length > 0 ) {
			annotation.setValue( "joinColumns", joinColumns );
		}
		buildUniqueConstraints( annotation, subelement );
		buildIndex( annotation, subelement );
		annotationList.add( AnnotationFactory.create( annotation ) );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:JPAOverriddenAnnotationReader.java

示例2: buildHierarchyColumnOverride

import javax.persistence.JoinColumn; //導入依賴的package包/類
private void buildHierarchyColumnOverride(XClass element) {
	XClass current = element;
	Map<String, Column[]> columnOverride = new HashMap<String, Column[]>();
	Map<String, JoinColumn[]> joinColumnOverride = new HashMap<String, JoinColumn[]>();
	Map<String, JoinTable> joinTableOverride = new HashMap<String, JoinTable>();
	while ( current != null && !mappings.getReflectionManager().toXClass( Object.class ).equals( current ) ) {
		if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class )
				|| current.isAnnotationPresent( Embeddable.class ) ) {
			//FIXME is embeddable override?
			Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() );
			Map<String, JoinColumn[]> currentJoinOverride = buildJoinColumnOverride( current, getPath() );
			Map<String, JoinTable> currentJoinTableOverride = buildJoinTableOverride( current, getPath() );
			currentOverride.putAll( columnOverride ); //subclasses have precedence over superclasses
			currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses
			currentJoinTableOverride.putAll( joinTableOverride ); //subclasses have precedence over superclasses
			columnOverride = currentOverride;
			joinColumnOverride = currentJoinOverride;
			joinTableOverride = currentJoinTableOverride;
		}
		current = current.getSuperclass();
	}

	holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null;
	holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null;
	holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:27,代碼來源:AbstractPropertyHolder.java

示例3: getExactOverriddenJoinColumn

import javax.persistence.JoinColumn; //導入依賴的package包/類
/**
 * Get column overriding, property first, then parent, then holder
 */
private JoinColumn[] getExactOverriddenJoinColumn(String propertyName) {
	JoinColumn[] override = null;
	if ( parent != null ) {
		override = parent.getExactOverriddenJoinColumn( propertyName );
	}
	if ( override == null && currentPropertyJoinColumnOverride != null ) {
		override = currentPropertyJoinColumnOverride.get( propertyName );
	}
	if ( override == null && holderJoinColumnOverride != null ) {
		override = holderJoinColumnOverride.get( propertyName );
	}
	return override;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:AbstractPropertyHolder.java

示例4: buildJoinColumns

import javax.persistence.JoinColumn; //導入依賴的package包/類
public static Ejb3JoinColumn[] buildJoinColumns(
		JoinColumn[] anns,
		String mappedBy,
		Map<String, Join> joins,
		PropertyHolder propertyHolder,
		String propertyName,
		Mappings mappings) {
	return buildJoinColumnsWithDefaultColumnSuffix(
			anns, mappedBy, joins, propertyHolder, propertyName, "", mappings
	);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:Ejb3JoinColumn.java

示例5: getParentType

import javax.persistence.JoinColumn; //導入依賴的package包/類
@ManyToOne(targetEntity = GoodsType8JPA.class, cascade = ALL,
          fetch = EAGER)
@JoinColumn(name = "parent_id", foreignKey =
@ForeignKey(name = "fk_parent"))
public GoodsType8JPA getParentType()
{
    return parentType;
}
 
開發者ID:SessionFactory,項目名稱:tinyshop8,代碼行數:9,代碼來源:GoodsType8JPA.java

示例6: parseDefinition

import javax.persistence.JoinColumn; //導入依賴的package包/類
private static EntityDefinition parseDefinition(Class<?> clazz) {
	if (!clazz.isAnnotationPresent(Entity.class)) {
		throw new IllegalArgumentException("Class "+clazz+" is not an @Entity");
	}
	EntityDefinition.Builder edb = new EntityDefinition.Builder(clazz);
	try {
		Constructor<?> constructor = clazz.getConstructor();
		edb.withConstructor(constructor);
	} catch (Exception e) {
		throw new IllegalArgumentException("Entity must have an empty constructor");
	}		
	if (clazz.isAnnotationPresent(Table.class)) {
		Table tableAnnotation = clazz.getAnnotation(Table.class);
		edb.withTable(tableAnnotation.name());
	}
	Field[] fields = clazz.getFields();
	if (fields != null) {
		int index = 0;
		for (Field f : fields) {
			if ((f.getModifiers() & Modifier.STATIC) == 0) {
				if (f.isAnnotationPresent(Id.class)) {
					edb.withIdField(parseField(f));
				} else {
					if (f.isAnnotationPresent(Transient.class)) {
						continue;
					} else if (f.isAnnotationPresent(JoinColumn.class)) {
						JoinColumn c = f.getAnnotation(JoinColumn.class);
						edb.withField(FieldInfo.entity(index++, f, c.name(), c.required()));
					} else {
						edb.withField(parseField(f));							
					}						
				}
			}
		}
	}
	return edb.create();
}
 
開發者ID:tiberiusteng,項目名稱:financisto1-holo,代碼行數:38,代碼來源:EntityManager.java

示例7: buildJoinColumns

import javax.persistence.JoinColumn; //導入依賴的package包/類
private void buildJoinColumns(List<Annotation> annotationList, Element element) {
	JoinColumn[] joinColumns = getJoinColumns( element, false );
	if ( joinColumns.length > 0 ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( JoinColumns.class );
		ad.setValue( "value", joinColumns );
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:JPAOverriddenAnnotationReader.java

示例8: getRoles

import javax.persistence.JoinColumn; //導入依賴的package包/類
@XmlTransient
 @LazyCollection(LazyCollectionOption.EXTRA)
 @ManyToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
 @JoinTable(name = "role_mappings", joinColumns = { 
@JoinColumn(name = "user_id", nullable = false, updatable = false) }, 
inverseJoinColumns = { @JoinColumn(name = "role", 
		nullable = false, updatable = false) })
 public List<Role> getRoles() {return _roles;}
 
開發者ID:awslabs,項目名稱:aws-photosharing-example,代碼行數:9,代碼來源:User.java

示例9: getRoles

import javax.persistence.JoinColumn; //導入依賴的package包/類
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "org_user_role_rel", 
		joinColumns = {@JoinColumn(name = "user_id")}, 
		inverseJoinColumns = {@JoinColumn(name = "role_id")})
@Where(clause="delete_flag=0")
@OrderBy("no")
public Set<Role> getRoles() {
	return roles;
}
 
開發者ID:xujeff,項目名稱:tianti,代碼行數:10,代碼來源:User.java

示例10: getBundle

import javax.persistence.JoinColumn; //導入依賴的package包/類
@JoinColumn(nullable = false)
@ManyToOne(fetch = FetchType.LAZY)
@Index(name = "bundleIndex")
public LanguageBundle getBundle()
{
	return bundle;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:8,代碼來源:LanguageString.java

示例11:

import javax.persistence.JoinColumn; //導入依賴的package包/類
@OneToMany(targetEntity = Goods8JPA.class, cascade = ALL,
          fetch = EAGER)
@JoinColumn(name = "join_goods_type_m2o", foreignKey =
@ForeignKey(name = "fk_goods_type_m2o"))
@JoinTable(name = "jpa_goods_type_set", foreignKey =
@ForeignKey(name = "fk_jpa_goods_type_set"))
public Set<Goods8JPA> getGoods8JPASet()
{
    return goods8JPASet;
}
 
開發者ID:SessionFactory,項目名稱:tinyshop8,代碼行數:11,代碼來源:GoodsType8JPA.java

示例12: getCode

import javax.persistence.JoinColumn; //導入依賴的package包/類
/**
 * @return code
 */
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "idCode")
public AccessCodeEntity getCode() {

  return this.code;
}
 
開發者ID:oasp,項目名稱:oasp-tutorial-sources,代碼行數:10,代碼來源:VisitorEntity.java

示例13: getService

import javax.persistence.JoinColumn; //導入依賴的package包/類
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "service_id")
public QService getService() {
    return service;
}
 
開發者ID:bcgov,項目名稱:sbc-qsystem,代碼行數:6,代碼來源:QCustomer.java

示例14: getSendmailTemplate

import javax.persistence.JoinColumn; //導入依賴的package包/類
/** @return null. */
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "TEMPLATE_ID")
public SendmailTemplate getSendmailTemplate() {
    return this.sendmailTemplate;
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:7,代碼來源:SendmailAttachment.java

示例15: getProduct

import javax.persistence.JoinColumn; //導入依賴的package包/類
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="productCode", nullable=false, insertable=false, updatable=false)
@JsonBackReference("order-product")
public Product getProduct() {
    return this.product;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:OrderDetail.java


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