本文整理匯總了Java中javax.persistence.JoinColumns類的典型用法代碼示例。如果您正苦於以下問題:Java JoinColumns類的具體用法?Java JoinColumns怎麽用?Java JoinColumns使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JoinColumns類屬於javax.persistence包,在下文中一共展示了JoinColumns類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getReferenceColumnNamesMapForReferenceAttribute
import javax.persistence.JoinColumns; //導入依賴的package包/類
private Map<String, String> getReferenceColumnNamesMapForReferenceAttribute(SingularAttribute<?, ?> attribute, ManagedType<?> targetEntity) {
List<String> idAttributeNames = targetEntity.getSingularAttributes().stream()
.filter(this::isIdAttribute)
.map(this::getSingularAttributeColumnName)
.collect(Collectors.toList());
JoinColumns joinColumnsAnnotation =
((AnnotatedElement) attribute.getJavaMember()).getAnnotation(JoinColumns.class);
JoinColumn joinColumnAnnotation =
((AnnotatedElement) attribute.getJavaMember()).getAnnotation(JoinColumn.class);
JoinColumn[] joinColumns = joinColumnsAnnotation != null ? joinColumnsAnnotation.value() :
joinColumnAnnotation != null ? new JoinColumn[]{joinColumnAnnotation} : null;
Map<String, String> referenceColumnNamesMap;
if (joinColumns != null) {
referenceColumnNamesMap = Arrays.stream(joinColumns)
.collect(Collectors.toMap(JoinColumn::name, joinColumn ->
joinColumn.referencedColumnName().length() > 0 ? joinColumn.referencedColumnName() :
idAttributeNames.get(0)));
} else {
referenceColumnNamesMap = idAttributeNames.stream()
.collect(Collectors.toMap(idAttributeName -> attribute.getName().toUpperCase() + "_"
+ idAttributeName, idAttributeName -> idAttributeName));
}
return referenceColumnNamesMap;
}
示例2: addForeignKey
import javax.persistence.JoinColumns; //導入依賴的package包/類
private void addForeignKey(final Attribute<?, ?> jpaAttribute) throws ODataJPAModelException,
ODataJPARuntimeException {
AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
joinColumnNames = null;
if (annotatedElement == null) {
return;
}
JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
if (joinColumn == null) {
JoinColumns joinColumns = annotatedElement.getAnnotation(JoinColumns.class);
if (joinColumns != null) {
for (JoinColumn jc : joinColumns.value()) {
buildForeignKey(jc, jpaAttribute);
}
}
} else {
buildForeignKey(joinColumn, jpaAttribute);
}
}
示例3: buildJoinColumns
import javax.persistence.JoinColumns; //導入依賴的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 ) );
}
}
示例4: getView
import javax.persistence.JoinColumns; //導入依賴的package包/類
@OneToOne(cascade = CascadeType.PERSIST)
@JoinColumns ({
@JoinColumn(name = "view" , referencedColumnName = "dataid" ),
@JoinColumn(name = "creater" , referencedColumnName = "creater" )
})
public TopicView getView() {
return view;
}
示例5: getRecord
import javax.persistence.JoinColumns; //導入依賴的package包/類
@ForeignKey(name = "none")
@MapsId("record")
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = COLUMN_RECORD_ID, referencedColumnName = "id")
})
public RAuditEventRecord getRecord() {
return record;
}
示例6: getAssignment
import javax.persistence.JoinColumns; //導入依賴的package包/類
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "unit_id", referencedColumnName = "unit_id", nullable = false),
@JoinColumn(name = "operational_period_id", referencedColumnName = "operational_period_id", nullable = false) })
public Assignment getAssignment() {
return this.assignment;
}
示例7: getStorage
import javax.persistence.JoinColumns; //導入依賴的package包/類
@NotNull
@ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumns(value = {
@JoinColumn(name = "storage_owner_id", referencedColumnName = "owner_id", insertable = false, updatable = false),
@JoinColumn(name = "storage_name", referencedColumnName = "name", insertable = false, updatable = false)
}, foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "storage_tag_object_statistics_fk_storage"))
public Storage getStorage() {
return storage;
}
示例8: getBucketObject
import javax.persistence.JoinColumns; //導入依賴的package包/類
@NotNull
@ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumns(
foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "bucket_object_version_fk_bucket_object"),
value = {
@JoinColumn(name = "bucket_id", referencedColumnName = "bucket_id", insertable = false, updatable = false),
@JoinColumn(name = "object_name", referencedColumnName = "name", insertable = false, updatable = false)
})
public BucketObject getBucketObject() {
return bucketObject;
}
示例9: getStorage
import javax.persistence.JoinColumns; //導入依賴的package包/類
@NotNull
@ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumns(
foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "bucket_object_version_fk_storage"),
value = {
@JoinColumn(name = "storage_owner_id", referencedColumnName = "owner_id"),
@JoinColumn(name = "storage_name", referencedColumnName = "name")
})
public Storage getStorage() {
return storage;
}
示例10: getContentVersion
import javax.persistence.JoinColumns; //導入依賴的package包/類
@ManyToOne(optional = true, fetch = FetchType.LAZY)
@JoinColumns(
foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "bucket_object_fk_content_version"),
value = {
@JoinColumn(name = "bucket_id", referencedColumnName = "bucket_id", insertable = false, updatable = false),
@JoinColumn(name = "name", referencedColumnName = "object_name", insertable = false, updatable = false),
@JoinColumn(name = "content_version_uuid", referencedColumnName = "version_uuid", insertable = false, updatable = false)
})
public BucketObjectVersion getContentVersion() {
return contentVersion;
}
示例11: getStorage
import javax.persistence.JoinColumns; //導入依賴的package包/類
@NotNull
@ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumns(
foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "bucket_fk_storage"),
value = {
@JoinColumn(name = "storage_owner", referencedColumnName = "owner_id"),
@JoinColumn(name = "storage_name", referencedColumnName = "name")
})
public Storage getStorage() {
return storage;
}
示例12: getQuotaPlan
import javax.persistence.JoinColumns; //導入依賴的package包/類
@NotNull
@ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumns(value = {
@JoinColumn(name = "quota_plan_id", referencedColumnName = "quota_model_id"),
@JoinColumn(name = "quota_plan_limit", referencedColumnName = "gigabyte_limit")
}, foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "storage_fk_quota_plan"))
public StorageQuotaPlan getQuotaPlan() {
return quotaPlan;
}
示例13: getPlayersHasQuests
import javax.persistence.JoinColumns; //導入依賴的package包/類
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "players_has_quests_players_idplayers", referencedColumnName = "players_idplayers", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "players_has_quests_quests_idquests", referencedColumnName = "quests_idquests", nullable = false, insertable = false, updatable = false) })
public PlayersHasQuests getPlayersHasQuests() {
return this.playersHasQuests;
}
示例14: getPlacesHasTransports
import javax.persistence.JoinColumns; //導入依賴的package包/類
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumns({
@JoinColumn(name = "places_has_transports_places_origin", referencedColumnName = "places_origin", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "places_has_transports_transportation", referencedColumnName = "transportation", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "places_has_transports_places_destination", referencedColumnName = "places_destination", nullable = false, insertable = false, updatable = false) })
public PlacesHasTransports getPlacesHasTransports() {
return this.placesHasTransports;
}
示例15: getTurnsHistory
import javax.persistence.JoinColumns; //導入依賴的package包/類
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "turns_history_players_has_quests_players_idplayers", referencedColumnName = "players_has_quests_players_idplayers", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "turns_history_players_has_quests_quests_idquests", referencedColumnName = "players_has_quests_quests_idquests", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "turns_history_places_has_transports_places_origin", referencedColumnName = "places_has_transports_places_origin", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "turns_history_places_has_transports_transportation", referencedColumnName = "places_has_transports_transportation", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "turns_history_places_has_transports_places_destination", referencedColumnName = "places_has_transports_places_destination", nullable = false, insertable = false, updatable = false) })
public TurnsHistory getTurnsHistory() {
return this.turnsHistory;
}