Hi, i´m trying to map my objects categorie, subcategorie with their relations with tables from WSAT (aspnet_Roles, aspnet_Users, etc).
Categorie -> 1:N Subcategorie.
Subcategorie -> 1:N aspnet_Roles
At first time i create the tables of web administration tools with the installer aspnet_regsql.exe.
The code that i´m using in nhibernate.cfg.xml to creating all schema of my tables:
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="DAL.IGU.Categoria.hbm.xml" assembly="DAL" />
<mapping resource="DAL.IGU.Subcategoria.hbm.xml" assembly="DAL"/>
<mapping resource="DAL.IGU.Perfiles.hbm.xml" assembly="DAL"/>
<mapping resource="DAL.IGU.Roles.hbm.xml" assembly="DAL"/>
<mapping resource="DAL.IGU.Usuarios.hbm.xml" assembly="DAL"/>
<mapping resource="DAL.IGU.Aplicacion.hbm.xml" assembly="DAL"/>
<mapping resource="DAL.IGU.Profile.hbm.xml" assembly="DAL"/>
when i compile my web :
Load secciones - master : There is an object 'aspnet_Users' in my database.
In this momment my database only has been create the aspnet_* with the installer, but categories and subcategories not.
If i use :
<property name="hibernate.hbm2ddl.auto">create</property>
give me the same error.
Hibernate version:
1.2.0.3001
Mapping documents:
--------------------------------------------------------------Roles
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BLL.IGU.aspnet_Roles, BLL" lazy="false" table="aspnet_Roles">
<id name="RoleId" column="RoleId" type ="System.Guid">
<generator class="guid" />
</id>
<property name="ApplicationId" access="property" type="System.Guid" />
<property name="Description" access="property" type="System.String" />
<property name="LoweredRoleName" access="property" type="System.String" />
<property name="RoleName" access="property" type="System.String" />
<bag name="Subcategorias" table="INGEMA_TD_ROL_SUBCAT" lazy="false">
<key column="RoleId"/>
<many-to-many class="BLL.IGU.Subcategoria, BLL" column="ID_SUBCATEGORIA"/>
</bag>
</class>
---------------------------------------------------- Subcategories
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BLL.IGU.Subcategoria, BLL" lazy="false" table="INGEMA_TM_SUBCATEGORIAS">
<id name="Id_Subcategoria" column="ID_SUBCATEGORIA" type ="System.Int32">
<generator class="native" />
</id>
<property name="Codigo" access="property" type="System.String" length="20" />
<property name="RutaIcono" access="property" type="System.String" length="250" />
<property name="Nombre" access="property" type="System.String" length="250" />
<property name="Ruta" access="property" type="System.String" length="250" />
<property name="Descripcion" access="property" type="System.String" length="250" />
<!--Foreign key a la tabla categorias -->
<property name="Id_Categoria" access="property" type="System.Int32" />
<bag name="Roles" table="INGEMA_TD_ROL_SUBCAT" lazy="false" cascade="save-update">
<key column="ID_SUBCATEGORIA"/>
<many-to-many class="BLL.IGU.aspnet_Roles, BLL" column="RoleId"/>
</bag>
</class>
---------------------------------------------------------Categories
?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BLL.IGU.Categoria, BLL" lazy="false" table="INGEMA_TM_CATEGORIAS">
<id name="Id_Categoria" column="ID_CATEGORIA" type ="System.Int32">
<generator class="native" />
</id>
<property name="Codigo" access="property" type="System.String" length="20" />
<property name="RutaIcono" access="property" type="System.String" length="250" />
<property name="Nombre" access="property" type="System.String" length="250" />
<property name="Descripcion" access="property" type="System.String" length="250" />
<bag name="Subcategorias" lazy="false" cascade="save-update" inverse="true">
<key column="ID_CATEGORIA"/>
<one-to-many class="BLL.IGU.Subcategoria, BLL"/>
</bag>
-----------------------------------------------------------------------
|