Skip to content

Commit 3f0df4a

Browse files
fredericDelaportehazzik
authored andcommitted
Update the <any /> mapping documentation (#1809)
1 parent 24c5de6 commit 3f0df4a

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

doc/reference/modules/basic_mapping.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,24 +3353,25 @@
33533353
example, for audit logs, user session data, etc.
33543354
</para>
33553355

3356-
<programlisting><![CDATA[<any name="AnyEntity" id-type="Int64" meta-type="Eg.Custom.Class2TablenameType">
3357-
<column name="table_name"/>
3356+
<programlisting><![CDATA[<any name="AnyEntity" id-type="long" meta-type="class">
3357+
<column name="type"/>
33583358
<column name="id"/>
33593359
</any>]]></programlisting>
33603360

33613361
<para>
33623362
The <literal>meta-type</literal> attribute allows the application to specify a custom type that maps
33633363
database column values to persistent classes that have identifier properties of the type specified by
3364-
<literal>id-type</literal>. If the meta-type returns instances of <literal>System.Type</literal>,
3365-
nothing else is required. On the other hand, if it is a basic type like <literal>String</literal> or
3366-
<literal>Char</literal>, you must specify the mapping from values to classes.
3364+
<literal>id-type</literal>. If the meta-type is <literal>class</literal>, nothing else is required.
3365+
The class full name will be persisted in the database as the type of the associated entity.
3366+
On the other hand, if it is a basic type like <literal>string</literal> or
3367+
<literal>char</literal>, you must specify the mapping from values to classes.
33673368
</para>
33683369

33693370
<programlisting><![CDATA[<any name="being" id-type="long" meta-type="string">
3370-
<meta-value value="TBL_ANIMAL" class="Animal"/>
3371-
<meta-value value="TBL_HUMAN" class="Human"/>
3372-
<meta-value value="TBL_ALIEN" class="Alien"/>
3373-
<column name="table_name"/>
3371+
<meta-value value="ANIMAL_TYPE" class="Animal"/>
3372+
<meta-value value="HUMAN_TYPE" class="Human"/>
3373+
<meta-value value="ALIEN_TYPE" class="Alien"/>
3374+
<column name="type"/>
33743375
<column name="id"/>
33753376
</any>]]></programlisting>
33763377

@@ -3419,9 +3420,8 @@
34193420
</callout>
34203421
<callout arearefs="any3">
34213422
<para>
3422-
<literal>meta-type</literal> (optional - defaults to <literal>Type</literal>): a type that
3423-
maps <literal>System.Type</literal> to a single database column or, alternatively, a type
3424-
that is allowed for a discriminator mapping.
3423+
<literal>meta-type</literal> (optional - defaults to <literal>string</literal>): a type
3424+
that is allowed for a discriminator mapping, or <literal>class</literal>.
34253425
</para>
34263426
</callout>
34273427
<callout arearefs="any4">

doc/reference/modules/collection_mapping.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ session.Update(category); // The relationship will be saved]]></programlist
12841284
<para>
12851285
The <literal>&lt;many-to-any&gt;</literal> and <literal>&lt;index-many-to-any&gt;</literal>
12861286
elements provide for true heterogeneous associations. These mapping elements work in the
1287-
same way as the <link linkend="mapping-types-anymapping"><literal>&lt;any&gt;</literal>
1287+
same way than the <link linkend="mapping-types-anymapping"><literal>&lt;any&gt;</literal>
12881288
element</link> - and should also be used rarely, if ever.
12891289
</para>
12901290

0 commit comments

Comments
 (0)