Hola a todos,

Estoy usando SchemaExport para generar el DDL de un mapping, y está
sucediéndome algo que a mi me parece bastante extraño:

Hay mapeada una herencia desde la clase Subject a otras llamadas
StatusUpdate, Place, Brand y alguna otra mas. Estoy usando un table
per concrete subclass.

Subject tiene una many-to-one a otra clase llamada User.

El caso es que en el DDL, se generan columnas "user" (entiendo que
sería la FK a user.id segun el namingstrategy) no sólo en Subject
(como era de esperar) sino también en StatusUpdate y en Place (y en
otras que no he pegado). Sin embargo, en Brand no se genera.

Este es el DDL que se genera para las 3 tablas con SQLite (no es el
script original, es el resultado de volcarlo con sqlite):
/* DDL information for - subject */
-----------------------------------
CREATE TABLE "subject" ("id" INTEGER not null, "modified_at" DATETIME
not null, "created_at" DATETIME not null, "user" INTEGER not null,
primary key ("id"))
/* DDL information for - brand */
---------------------------------
CREATE TABLE "brand" ("id" INTEGER not null, "name" TEXT, primary key ("id"))
/* DDL information for - place */
---------------------------------
CREATE TABLE "place" ("id" INTEGER not null, "name" TEXT, "street"
TEXT not null, "number" TEXT, "floor_and_others" TEXT, "zip_code"
TEXT, "city" INTEGER not null, "place_type" INTEGER, "user" INTEGER,
primary key ("id"))

Y este el mapping:

    <class name="MyApp.Core.Subject, MyApp">
        <id name="Id">
            <generator class="hilo" />
        </id>
        <timestamp name="ModifiedAt" />
        <property name="CreatedAt" not-null="true" />
        <many-to-one name="User" not-null="true" />

        <bag name="Comments" inverse="true" lazy="true"
cascade="all-delete-orphan" order-by="CreatedAt">
            <key column="subject" />
            <one-to-many class="MyApp.Core.Comment, MyApp"/>
        </bag>

        <joined-subclass name="MyApp.Users.StatusUpdate, MyApp">
            <key column="id" />
            <property name="UpdateInfo" not-null="true" type="StringClob"/>
            <joined-subclass name="MyApp.Geo.Visit, W.Domain">
                <key column="id" />

                <property name="ScheduledAt" not-null="false"/>
                <many-to-one name="Place" not-null="true" />

            </joined-subclass>
        </joined-subclass>

        <joined-subclass name="MyApp.Geo.Place, MyApp">
            <key column="id" />

            <property name="Name" />

            <bag name="Visits" inverse="true" lazy="true"
cascade="all-delete-orphan">
                <key column="place" />
                <one-to-many class="MyApp.Geo.Visit, MyApp"/>
            </bag>

            <component name="PostalAddressInformation">
                <property name="Street" not-null="true" />
                <property name="Number" />
                <property name="FloorAndOthers" />
                <property name="ZipCode" />
                <many-to-one name="City" not-null="true" />
            </component>
            <many-to-one name="PlaceType" />
        </joined-subclass>

        <joined-subclass name="MyApp.Brands.Brand, MyApp">
            <key column="id" />

            <property name="Name" length="250" not-null="false" />

            <bag name="BrandTypes" lazy="false" table="brand_to_brand_type">
                <key column="brand" />
                <many-to-many class="MyApp.Brands.Brand, MyApp"
column="brand_type" />
            </bag>

        </joined-subclass>

    </class>

¿Alguna ayuda o posible explicación?

Francisco A. Lozano

--~--~---------~--~----~------------~-------~--~----~
Para escribir al Grupo, hágalo a esta dirección: 
[email protected]
Para más, visite: http://groups.google.com/group/NHibernate-Hispano
-~----------~----~----~----~------~----~------~--~---

Responder a