Association Properties

NHibernate associations have the following properties:

Ends

End 1

Specifies the property of the child class that references the associated parent class.

Access

Specifies the strategy used to access the property values. Can accept the following values: Default (Property), Property, Field or Nosetter.

Attributes

Specifies attributes of the object.

Cascade

Specifies which operation should be cascaded from the parent object to the associated object. Can accept the following values: Default, None, All, SaveUpdate, Delete.

Constrained

(available for one-to-one associations) specifies that a foreign key constraint on the primary key of the mapped table references the table of the associated class. Can accept the following values: True, or False.

Documentation

Long Description

Detailed description of the property.

Summary

Brief description of the property.

Fetch

Makes it possible to choose either outer-join fetching or sequential select fetching. Can accept the following values: Select, or Join.

Generate

Determines whether the corresponding property should be created in the class. Can accept the following values: True, or False.

Generate Data Member Attribute

Specifies whether the association should be serialized. Can accept the following values: True, or False.

Getter Modifier

Specifies the getter accessibility level. Can accept the following values: Public, ProtectedInternal, Internal, Protected, Private.

Insert

Specifies that the mapped columns should be included in SQL INSERT statement. Can accept the following values: True, or False.

Join Table

Specifies the name of the table this property belongs to.

Multiplicity

Specifies the multiplicity for this end of the association.

Name

Specifies the name of the member property of an association.

Not Found

Specifies how foreign keys that reference missing rows will be handled. Acceptable values are: Exception, or Ignore.

Optimistic Lock

Specifies that updates to this property do or do not require acquisition of the optimistic lock. Can accept the following values: True, or False.

Separate FK

(available for one-to-one associations) specifies that the mapped table has separate foreign key column(s).

Setter Modifier

Specifies the setter accessibility level. Can accept the following values: Public, ProtectedInternal, Internal, Protected, Private.

Property Ref

Specifies the name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used.

Unimplemented

Determines whether to exclude the definition and initialization code of the property from the class. Can accept the following values: True, or False.

Unique

Enables or disables the DDL generation of a unique constraint for the foreign-key column. Can accept the following values: True, or False.

Update

Specifies that the mapped columns should be included in SQL UPDATE statement. Can accept the following values: True, or False.

End 2

Specifies the property on the parent that is a collection or reference to child records on the foreign key side of the association.

Access

The strategy used to access the property value. Can accept the following values: Default (Property), Property, Field, None, or Nosetter.

Attributes

Specifies attributes of the object.

Batch Size

(available if the End's multiplicity equals Many) specifies the batch size for lazily fetching instances of this collection.

Cache

(available if the End's multiplicity equals Many) specifies second level cache settings.

Region

Specifies the name of the second level cache region.

Usage

Specifies the caching strategy, acceptable values are ReadWrite, NonStrictReadWrite and ReadOnly.

Cascade

Specifies which operation should be cascaded from the parent to the associated object. Can accept the following values: Default, None, All, SaveUpdate, Delete, DeleteOrphan, AllDeleteOrphan.

Collection Type

(available if the End's multiplicity equals Many) specifies the type of the collection. Can accept the following values: Set, Bag, Map, List, or Array.

Constrained

(available for one-to-one associations) specifies that a foreign key constraint on the primary key of the mapped table references the table of the associated class. Can accept the following values: True, or False.

Documentation

Long Description

Detailed description of the property.

Summary

Brief description of the property.

Fetch

Makes it possible to choose either outer-join fetching or sequential select fetching. Can accept the following values: Select, or Join.

Filter

(available if the End's multiplicity equals Many) specifies the filter to be used when retrieving or removing the collection.

A filter criterion allows you to define a restriction clause similar to the existing "where" attribute available on various collection elements. These filter conditions, however, can be parameterized. The application can then decide at runtime whether certain filters should be enabled and what their parameter values should be. Filters can be used like database views, but they are parameterized inside the application.

In order to use filters, they must first be defined and then attached to the appropriate mapping elements, for details see Filtering Data.

Generate

Determines whether the corresponding property should be created in the class. Can accept the following values: True, or False.

Generate Data Member Attribute

Specifies whether the association should be serialized. Can accept the following values: True, or False.

Generic

(available if the End's multiplicity equals Many) specifies whether to use a generic collection type. Can accept the following values: True, or False.

Getter Modifier

Specifies the getter accessibility level. Can accept the following values: Public, ProtectedInternal, Internal, Protected, Private.

Index Type

(available if the End's multiplicity equals Many) specifies the type of the collection index. Can accept the following values: AnsiChar, AnsiString, Binary, BinaryBlob, Boolean, Byte, Char, CultureInfo, Currency, Date, DateTime, DateTime2, DateTimeOffset, DbTimestamp, LocalDateTime, UtcDateTime, Decimal, Double, Guid, Int16, Int32, Int64, Object, SByte, Serializable, Single, String, StringClog, Ticks, Time, TimeAsTimeSpan, TimeSpan, Timestamp, TrueFalse, Type, UInt16, UInt32, UInt64, YesNo, Classes, Complex types and Enum types.

Inverse

(available if the End's multiplicity equals Many) marks the collection as the 'inverse' end of a bidirectional association. Can accept the following values: True, or False.

Join Table

Specifies the name of the table this property belongs to.

Lazy

Enables or disables lazy fetching. For Many end can accept the following values: Default, True, False, or Extra. For One end can accept True or False.

Multiplicity

Determines the multiplicity for this end of the association.

Name

Specifies the name of the member property of an association.

Not found

Specifies how foreign keys that reference missing rows will be handled. Can accept the following values: Exception, or Ignore.

Optimistic Lock

Specifies that updates to this property do or do not require acquisition lock. Can accept the following values: True, or False.

Order By

Denotes one or more table columns that define the iteration order.

Property Ref

The name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used.

Separate FK

(available for one-to-one associations) specifies that the mapped table has separate foreign key column(s).

Setter Modifier

Specifies the setter accessibility level. Can accept the following values: Public, ProtectedInternal, Internal, Protected, Private.

Sort

(available if the End's multiplicity equals Many) specifies a sorted collection with natural sort order, or a given comparator class. Can accept the following values: unsorted, or natural.

Unimplemented

Determines whether to exclude the definition and initialization code of the property from the class. Can accept the following values: True, or False.

Where

(available if the End's multiplicity equals Many) an arbitrary SQL WHERE condition to be used when retrieving or removing the collection.

General

Name

Specifies the name of the association.

Join Table

Schema

Specifies the schema of a join table for the many-to-many or composite-element mapped association.

Table

Specifies the name of a join table for the many-to-many or composite-element mapped association.

Many-to-many

Many-to-Many Component

Specifies the complex type for mapping extra columns of a many-to-many association table.

 

ExpandedToggleIcon        See Also


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.