From: <fab...@us...> - 2009-07-14 13:12:31
|
Revision: 4612 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4612&view=rev Author: fabiomaulo Date: 2009-07-14 13:12:28 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Merge r4611 Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/basic_mapping.xml Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2009-07-14 13:11:16 UTC (rev 4611) +++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2009-07-14 13:12:28 UTC (rev 4612) @@ -1656,7 +1656,45 @@ <programlisting><![CDATA[<one-to-one name="Employee" class="Employee" property-ref="Person"/>]]></programlisting> </sect2> - + + <sect2 id="mapping-declaration-naturalid"> + <title>natural-id</title> + + <programlisting><![CDATA[<natural-id mutable="true|false"/> + <property ... /> + <many-to-one ... /> + ...... +</natural-id>]]></programlisting> + + <para> + Even though we recommend the use of surrogate keys as primary keys, you should still try + to identify natural keys for all entities. A natural key is a property or combination of + properties that is unique and non-null. If it is also immutable, even better. Map the + properties of the natural key inside the <literal><natural-id></literal> element. + Hibernate will generate the necessary unique key and nullability constraints, and your + mapping will be more self-documenting. + </para> + + <para> + We strongly recommend that you implement <literal>Equals()</literal> and + <literal>GetHashCode()</literal> to compare the natural key properties of the entity. + </para> + + <para> + This mapping is not intended for use with entities with natural primary keys. + </para> + + <itemizedlist spacing="compact"> + <listitem> + <para> + <literal>mutable</literal> (optional, defaults to <literal>false</literal>): + By default, natural identifier properties as assumed to be immutable (constant). + </para> + </listitem> + </itemizedlist> + + </sect2> + <sect2 id="mapping-declaration-component"> <title>component, dynamic-component</title> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-07-14 19:00:42
|
Revision: 4630 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4630&view=rev Author: fabiomaulo Date: 2009-07-14 19:00:35 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Merge r4629 Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/basic_mapping.xml Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2009-07-14 18:59:32 UTC (rev 4629) +++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2009-07-14 19:00:35 UTC (rev 4630) @@ -2499,8 +2499,25 @@ The <literal>IUserType</literal> can now retrieve the value for the parameter named <literal>default</literal> from the <literal>IDictionary</literal> object passed to it. </para> - <para> + If you use a certain <literal>UserType</literal> very often, it may be useful to define a + shorter name for it. You can do this using the <literal><typedef></literal> element. + Typedefs assign a name to a custom type, and may also contain a list of default + parameter values if the type is parameterized. + </para> + + <programlisting><![CDATA[<typedef class="MyCompany.UserTypes.DefaultValueIntegerType" name="default_zero"> + <param name="default">0</param> +</typedef>]]></programlisting> + + <programlisting><![CDATA[<property name="priority" type="default_zero"/>]]></programlisting> + + <para> + It is also possible to override the parameters supplied in a typedef on a case-by-case basis + by using type parameters on the property mapping. + </para> + + <para> Even though NHibernate's rich range of built-in types and support for components means you will very rarely <emphasis>need</emphasis> to use a custom type, it is nevertheless considered good form to use custom types for (non-entity) classes that occur frequently This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-07-22 16:10:12
|
Revision: 5047 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5047&view=rev Author: fabiomaulo Date: 2010-07-22 16:10:05 +0000 (Thu, 22 Jul 2010) Log Message: ----------- Fix NH-2083 Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/basic_mapping.xml Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-07-22 15:56:09 UTC (rev 5046) +++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-07-22 16:10:05 UTC (rev 5047) @@ -102,13 +102,18 @@ <area id="hm3" coords="4 55"/> <area id="hm4" coords="5 55"/> <area id="hm5" coords="6 55"/> + <area id="hm6" coords="7 55"/> + <area id="hm7" coords="8 55"/> </areaspec> - <programlisting><![CDATA[<hibernate-mapping + <programlisting> + <![CDATA[<hibernate-mapping schema="schemaName" default-cascade="none|save-update" auto-import="true|false" assembly="Eg" namespace="Eg" + default-access="field|property|field.camecase..." + default-lazy="true|false" />]]></programlisting> <calloutlist> <callout arearefs="hm1"> @@ -136,6 +141,18 @@ document. </para> </callout> + <callout arearefs="hm6"> + <para> + <literal>default-access</literal> (optional - defaults to property): + The strategy NHibernate should use for accessing a property value + </para> + </callout> + <callout arearefs="hm7"> + <para> + <literal>default-lazy</literal> (optional - defaults to <literal>true</literal>): + Lazy fetching may be completely disabled by setting default-lazy="false". + </para> + </callout> </calloutlist> </programlistingco> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-09-24 02:40:23
|
Revision: 5208 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5208&view=rev Author: fabiomaulo Date: 2010-09-24 02:40:17 +0000 (Fri, 24 Sep 2010) Log Message: ----------- Fix NH-2321 Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/basic_mapping.xml Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-09-23 23:10:31 UTC (rev 5207) +++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-09-24 02:40:17 UTC (rev 5208) @@ -72,11 +72,13 @@ <para><emphasis> Tip: to enable IntelliSense for mapping and configuration files, copy the appropriate - <literal>.xsd</literal> files to - <literal><VS.NET installation directory>\Common7\Packages\schemas\xml</literal> - if you are using Visual Studio .NET 2003, or to - <literal><VS 2005 installation directory>\Xml\Schemas</literal> for Visual Studio 2005. - </emphasis></para> + <literal>.xsd</literal> files as part of any project in your solution, + (<literal>Build Action</literal> can be "None") or as "Solution Files" or in your + <literal>"Lib"</literal> folder and then add it to the <literal>Schemas</literal> property of the xml file. + You can copy it in <literal><VS installation directory>\Xml\Schemas</literal>, take care because you will have to deal + with different version of the xsd for different versions of NHibernate. + </emphasis> + </para> </sect2> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-12-31 03:23:46
|
Revision: 5343 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5343&view=rev Author: julian-maughan Date: 2010-12-31 03:23:40 +0000 (Fri, 31 Dec 2010) Log Message: ----------- Port of Hibernate <properties> documentation, by Roger Kratz (ref. NH-2478) Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/basic_mapping.xml Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-12-31 03:20:16 UTC (rev 5342) +++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-12-31 03:23:40 UTC (rev 5343) @@ -225,7 +225,7 @@ <callout arearefs="class2"> <para> <literal>table</literal>(optional - defaults to the unqualified class name): The name of its database table. - </para> + </para> </callout> <callout arearefs="class3"> <para> @@ -1739,8 +1739,7 @@ insert="true|false" upate="true|false" access="field|property|nosetter|ClassName" - optimistic-lock="true|false" -> + optimistic-lock="true|false"> <property ...../> <many-to-one .... /> @@ -1805,6 +1804,113 @@ </sect2> + <sect2 id="mapping-declaration-properties"> + <title>properties</title> + + <para> + The <literal><properties></literal> element allows the + definition of a named, logical grouping of the properties of a class. + The most important use of the construct is that it allows a combination + of properties to be the target of a <literal>property-ref</literal>. It + is also a convenient way to define a multi-column unique constraint. For + example: + </para> + + <programlistingco> + <areaspec> + <area coords="2 60" id="properties1" /> + <area coords="3 60" id="properties2" /> + <area coords="4 60" id="properties3" /> + <area coords="5 60" id="properties4" /> + <area coords="6 60" id="properties5" /> + </areaspec> + + <programlisting><![CDATA[<properties + name="logicalName" + insert="true|false" + update="true|false" + optimistic-lock="true|false" + unique="true|false"> + + <property .../> + <many-to-one .../> + ........ +</properties>]]></programlisting> + + <calloutlist> + <callout arearefs="properties1"> + <para> + <literal>name</literal>: the logical name of the grouping. + It is <emphasis>not</emphasis> an actual property name. + </para> + </callout> + + <callout arearefs="properties2"> + <para> + <literal>insert</literal>: do the mapped columns appear in + SQL <literal>INSERTs</literal>? + </para> + </callout> + + <callout arearefs="properties3"> + <para> + <literal>update</literal>: do the mapped columns appear in + SQL <literal>UPDATEs</literal>? + </para> + </callout> + + <callout arearefs="properties4"> + <para> + <literal>optimistic-lock</literal> (optional - defaults to + <literal>true</literal>): specifies that updates to these + properties either do or do not require acquisition of the + optimistic lock. It determines if a version increment should occur + when these properties are dirty. + </para> + </callout> + + <callout arearefs="properties5"> + <para> + <literal>unique</literal> (optional - defaults to + <literal>false</literal>): specifies that a unique constraint + exists upon all mapped columns of the component. + </para> + </callout> + </calloutlist> + </programlistingco> + + <para> + For example, if we have the following + <literal><![CDATA[<properties>]]></literal> mapping: + </para> + + <programlisting role="XML"><![CDATA[<class name="Person"> + <id name="personNumber" /> + <properties name="name" unique="true" update="false"> + <property name="firstName" /> + <property name="lastName" /> + <property name="initial" /> + </properties> +</class>]]></programlisting> + + <para> + You might have some legacy data association that refers to this + unique key of the <literal>Person</literal> table, instead of to the + primary key: + </para> + + <programlisting role="XML"><![CDATA[<many-to-one name="owner" class="Person" property-ref="name"> + <column name="firstName" /> + <column name="lastName" /> + <column name="initial" /> +</many-to-one>]]></programlisting> + + <para> + The use of this outside the context of mapping legacy data is not + recommended. + </para> + </sect2> + <sect2 id="mapping-declaration-subclass"> <title>subclass</title> @@ -1830,6 +1936,7 @@ dynamic-insert="true|false"> <property .... /> + <properties .... /> ..... </subclass>]]></programlisting> <calloutlist> @@ -1899,6 +2006,7 @@ <key .... > <property .... /> + <properties .... /> ..... </joined-subclass>]]></programlisting> <calloutlist> @@ -2003,6 +2111,7 @@ node="element-name"> <property .... /> + <properties .... /> ..... </union-subclass>]]></programlisting> <calloutlist> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2011-03-16 14:16:56
|
Revision: 5475 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5475&view=rev Author: julian-maughan Date: 2011-03-16 14:16:50 +0000 (Wed, 16 Mar 2011) Log Message: ----------- Documentation correction (ref. NH-2575) Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/basic_mapping.xml Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2011-03-16 04:24:20 UTC (rev 5474) +++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2011-03-16 14:16:50 UTC (rev 5475) @@ -319,7 +319,7 @@ </callout> </calloutlist> </programlistingco> - + <para> It is perfectly acceptable for the named persistent class to be an interface. You would then declare implementing classes of that interface using the <literal><subclass></literal> @@ -327,10 +327,10 @@ class name using the standard form ie. <literal>Eg.Foo+Bar, Eg</literal>. Due to an HQL parser limitation inner classes can not be used in queries in NHibernate 1.0. </para> - + <para> - Immutable classes, <literal>mutable="false"</literal>, may not be updated or deleted by the - application. This allows NHibernate to make some minor performance optimizations. + Changes to immutable classes, <literal>mutable="false"</literal>, will not be + persisted. This allows NHibernate to make some minor performance optimizations. </para> <para> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |