Estimados: tengo un problema al generar unos mappings y necesito de
sus conocimientos para que puedan ayudarme!!
Mis clases son: (están resumidas para el ejemplo)
Sucursal
-idSucursal
-Nombre
-Version
Empresa
-idEmpresa
-Sucursal
-Nombre
-Version
Mayorista :: Empresa
-Apellido
El Mapping para Empresa y para Mayorista:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="PruebaHibernate" namespace="PruebaHibernate.Domain">
<class name="Empresa" table="empresas">
<composite-id>
<key-property name="Id" column="idEmpresa" type="integer" />
<key-many-to-one class="Sucursal" name="Sucursal"
column="idSucursal" />
</composite-id>
<version name="Version" type="integer" unsaved-value="0"></
version>
<property name="Nombre" type="System.String" length="100" />
<joined-subclass name="Mayorista" table="mayoristas">
<key>
<column name="idEmpresa" />
<column name="idSucursal" />
</key>
<property name="Apellido" type="System.String" length="100" />
</joined-subclass>
</class>
</hibernate-mapping>
YO NECESITO QUE TANTO EMPRESA COMO MAYORISTA TENGAN SUS PROPIAS
TABLAS.
ADEMÁS NECESITO QUE LAS TABLA EMPRESA TENGA 2 PK (CLAVE COMBINADA): UN
ID AUTONUMÉRICO Y EL ID SUCURSAL. ESTO ES PORQUE EXISTEN VARIAS BASES
DE DATOS CON LA MISMA ESTRUCTURA PERO CON DATOS DISTINTOS, LAS CUALES
DEBEN SINCRONIZARSE UNA VEZ AL DÍA.
MI PROBLEMA ES QUE NO SE COMO INDICARLE A NHIBERNATE QUE EL IDEMPRESA
ES AUTONUMÉRICO.
ESPERO SUS COMENTARIOS.
MUCHAS GRACIAS!!!
JUAN IGNACIO.-
--
Para escribir al Grupo, hágalo a esta dirección:
[email protected]
Para más, visite: http://groups.google.com/group/NHibernate-Hispano