Porque tenes duplicado el elemento id dentro del XML.

Sugiero que busques en la documentación de NH las opciones que tenes para
mapear PKs compuestas

----------------------------------
Carlos Peix

2016-06-22 10:17 GMT-03:00 Javier Sanchez <[email protected]>:

> Hola
>
>
>
> Tengo la tabla
>
>
>
> CREATE TABLE dbo.TBLPEDIDOSPROLIN
>  (
>  IDPEDIDOPRO       INT NOT NULL,
>  IDPEDIDOPROLIN    INT NOT NULL,
>  IDARTICULO        INT NULL,
>  CANTIDAD          INT CONSTRAINT DF_TBLPEDIDOSPROLIN_CANTIDAD DEFAULT
> ((0)) NULL,
>  IDUNIDADTIPO      CHAR (2) CONSTRAINT DF_TBLPEDIDOSPROLIN_IDUNIDADTIPO
> DEFAULT ('') NOT NULL,
>  CANTIDADUNIDAD    INT CONSTRAINT DF_TBLPEDIDOSPROLIN_CANTIDADUNIDAD
> DEFAULT ((1)) NOT NULL,
>  REFPROVEEDOR      VARCHAR (25) NULL,
>  ATRIB1            VARCHAR (50) NULL,
>  ATRIB2            VARCHAR (50) NULL,
>  ATRIB3            VARCHAR (50) NULL,
>  IMPORTCIONESTADO  INT NULL,
>  IMPORTACIONESTADO INT NULL,
>  CONSTRAINT PK_TBLPEDIDOSPROLIN PRIMARY KEY (IDPEDIDOPRO, IDPEDIDOPROLIN),
>  CONSTRAINT FK_TBLPEDIDOSPROLIN_TBLPEDIDOSPROCAB FOREIGN KEY (IDPEDIDOPRO)
> REFERENCES dbo.TBLPEDIDOSPROCAB (IDPEDIDOPRO),
>  CONSTRAINT FK_TBLPEDIDOSPROLIN_TBLARTICULOS FOREIGN KEY (IDARTICULO)
> REFERENCES dbo.TBLARTICULOS (IDARTICULO)
>  )
> GO
>
>
>
> Con el mapeo
>
>
>
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>     assembly="WebServiceQuero"
>     namespace="Hibernate.Entities">
>
>
>
>   <class name="TblPedidosProLin">
>     <id column="IdPedidoPro">
>       <generator class="assing" />
>     </id>
>     <id column="IdPedidoProLin">
>       <generator class="assing" />
>     </id>
>     <property name="Cantidad" />
>     <property name="IdArticulo" />
>     <property name="ImportacionEstado" />
>   </class>
> </hibernate-mapping>
>
>
>
> Y la clase
>
>
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Web;
>
>
>
> namespace Hibernate.Entities
> {
>     public class TblPedidosProLin
>     {
>         private int idpedidopro;
>         private int idpedidoprolin;
>         private int idarticulo;
>         private int cantidad;
>         private int importacionEstado;
>
>
>
>         public virtual int IdPedidoPro
>         {
>             get { return idpedidopro; }
>             set { idpedidopro = value; }
>         }
>
>
>
>         public virtual int Cantidad
>         {
>             get { return cantidad; }
>             set { cantidad = value; }
>         }
>
>
>
>         public virtual int IdArticulo
>         {
>             get { return idarticulo; }
>             set { idarticulo = value; }
>         }
>
>
>
>         public virtual int ImportacionEstado
>         {
>             get { return importacionEstado; }
>             set { importacionEstado = value; }
>         }
>
>
>
>         public virtual int IdPedidoProLin
>         {
>             get { return idpedidoprolin; }
>             set { idpedidoprolin = value; }
>         }
>     }
> }
>
>
>
> ¿Por que me sale este error
>
> XML validation error: El elemento 'class' en espacio de nombres
> 'urn:nhibernate-mapping-2.2' tiene un elemento secundario 'id' en espacio
> de nombres 'urn:nhibernate-mapping-2.2' no válido. Lista esperada de
> elementos posibles: 'discriminator, natural?
>
>
>
> Saludos
>
> --
> --
> Para escribir al Grupo, hágalo a esta dirección:
> [email protected]
> Para más, visite: http://groups.google.com/group/NHibernate-Hispano
> ---
> Has recibido este mensaje porque estás suscrito al grupo
> "NHibernate-Hispano" de Grupos de Google.
> Para anular la suscripción a este grupo y dejar de recibir sus mensajes,
> envía un correo electrónico a
> [email protected].
> Para acceder a más opciones, visita https://groups.google.com/d/optout.
>

-- 
-- 
Para escribir al Grupo, hágalo a esta dirección: 
[email protected]
Para más, visite: http://groups.google.com/group/NHibernate-Hispano
--- 
Has recibido este mensaje porque estás suscrito al grupo "NHibernate-Hispano" 
de Grupos de Google.
Para anular la suscripción a este grupo y dejar de recibir sus mensajes, envía 
un correo electrónico a [email protected].
Para obtener más opciones, visita https://groups.google.com/d/optout.

Responder a