NPersistence Reference Guide
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)
Specifies a column for joining an entity association or element
collection.
Namespace: NPersistenceIf the JoinColumn annotation itself is defaulted, a single join column is assumed and the default values apply.
Examples
CopyC#
Example: [ManyToOne] [JoinColumn(name="ADDR_ID")] public Address getAddress() { return address; } Example: unidirectional one-to-many association using a foreign key mapping // In Customer class [OneToMany] [JoinColumn(name="CUST_ID")] // join column is in table for Order public Set<Order> getOrders() {return orders;}
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
C# |
public sealed class JoinColumn : Attribute
Members
All Members | Constructors | Fields |
Public Protected | Instance Static | Declared Inherited | XNA Framework Only .NET Compact Framework Only |
Member | Description | |
---|---|---|
JoinColumn()()()() | Initializes a new instance of the JoinColumn class | |
AttributeRef |
(Optional)
Points to the JoinTable, CollectionTable or AssociationOverride attribute which this JoinColumn belongs to.
If this JoinColumn is not part of a JoinTable, CollectionTable or AssociationOverride, this field should stay empty.
If this field is populated and references a JoinTable, this JoinColumn represents a foreign key column
of the join table which reference the
primary table of the entity owning the
association. (I.e. the owning side of
the association).
If this field is populated and references a collection table,
this JoinColumn references the primary table of the entity. The default
only applies if a single join column is used. The default is
the same as for JoinColumn (i.e., the
concatenation of the following: the name of the entity; "_";
the name of the referenced primary key column.) However, if
there is more than one join column, a JoinColumn
annotation must be specified for each join column . In this case, both the
name and the referencedColumnName
elements must be specified in each such
JoinColumn annotation.
If this field is populated and references an AssociationOverride, this JoinColumn represents a join column
being mapped to a persistent attribute.
The joinColumn elements must be specified if a
foreign key mapping is used in the overriding of the mapping of
the relationship. The joinColumn element must
not be specified if a join table is used in the overriding of
the mapping of the relationship.
| |
ColumnDefinition | (Optional) The SQL fragment that is used when
generating the DDL for the column.
Defaults to the generated SQL for the column.
| |
Insertable | (Optional) Whether the column is included in
SQL INSERT statements generated by the persistence
provider.
| |
Inverse | (Optional) Only relevant when this JoinColumn is part of a JoinTable.
This field indicates that this JoinColumn represents the foreign key
of the join table which references the
primary table of the entity that does
not own the association. (I.e. the
inverse side of the association).
| |
Name |
(Optional) The name of the foreign key column.
The table in which it is found depends upon the
context.
| |
Nullable | (Optional) Whether the foreign key column is nullable.
| |
ReferencedColumnName | (Optional) The name of the column referenced by this foreign
key column.
| |
Table | (Optional) The name of the table that contains
the column. If a table is not specified, the column
is assumed to be in the primary table of the
applicable entity.
Default:
| |
Unique | (Optional) Whether the property is a unique key. This is a
shortcut for the UniqueConstraint annotation at
the table level and is useful for when the unique key
constraint is only a single field. It is not necessary to
explicitly specify this for a join column that corresponds to a
primary key that is part of a foreign key.
| |
Updatable | (Optional) Whether the column is included in
SQL UPDATE statements generated by the persistence
provider.
|
Inheritance Hierarchy
System..::..Object
System..::..Attribute
NPersistence..::..JoinColumn
System..::..Attribute
NPersistence..::..JoinColumn