Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/05/2010, 09:55
yanuarys
 
Fecha de Ingreso: noviembre-2008
Mensajes: 43
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: Error NHibernate:not-null property references a null or transient value

Clase Productos

namespace SolGeSoft
{
[Serializable]
[HibernateMapping(Assembly = "SolGeSoft", Namespace = "SolGeSoft", DefaultAccess = "field.camelcase-underscore", DefaultLazy = true)]
[Class(Name = "SolGeSoft.Productos", Table = "t_producto")]
public class Productos //: IEquatable<SubFamilias>
{
private Guid _id_producto;
private string _cod_producto;
private Familias _familia;
private SubFamilias _subfamilia;
//private int _especialidad;
private string _descripcion;
private UnidadMedida _unidad;
private IList<ProductoSolicitud> _prod_sol;
// private IList<SolicitudCompra> solicitudcompraprod; poner
//private IList<SolicitudCompra> tallasproductos;
[Id(1, Name = "Id_producto", Type = "Guid", Column = "id_producto")]
//[Property(1, Column = "id_producto", Type = "Guid", Name = "Id_producto", NotNull = true)]
public virtual Guid Id_producto
{
get { return _id_producto; }
set { _id_producto = value; }
}
[Property(2, Column = "cod_prod", Type = "String", Name = "Cod_producto", NotNull = false)]
public virtual string Cod_producto
{
get { return _cod_producto; }
set { _cod_producto = value; }
}
[ManyToOne(3, Name = "Familia", Column = "cod_familia", Class = "SolGeSoft.Familias,SolGeSoft", NotNull = false)]
public virtual Familias Familia
{
get { return _familia; }
set { _familia = value; }
}
[ManyToOne(4, Name = "Subfamilia", Column = "id_subfamilia", Class = "SolGeSoft.SubFamilias,SolGeSoft", NotNull = false)]
public virtual SubFamilias Subfamilia
{
get { return _subfamilia; }
set { _subfamilia = value; }
}
//[Property(5, Name = "Especialidad", Column = "id_especialidad", Type = "int", NotNull = false)]
//public virtual int Especialidad
//{
// get { return _especialidad; }
// set { _especialidad = value; }
//}
[Property(5, Column = "Descripcion", Type = "String", Name = "Descripcion", NotNull = false)]
public virtual string Descripcion
{
get { return _descripcion; }
set { _descripcion = value; }


}
[ManyToOne(6, Name = "Unidad", Column = "id_unidad", Class = "SolGeSoft.UnidadMedida,SolGeSoft", NotNull = true, ForeignKey = "FK_t_producto_t_unidad_medida")]
public virtual UnidadMedida Unidad
{
get { return _unidad; }
set { _unidad = value; }
}
[OneToMany(7, Class = "SolGeSoft.ProductoSolicitud,SolGeSoft", NotFound = NotFoundMode.Ignore)]
public virtual IList<ProductoSolicitud> Prod_sol
{
get { return _prod_sol; }
set { _prod_sol = value; }
}

public virtual string CodigoFull
{
get { return _familia.Cod_familia + _subfamilia.Cod_subfamilia + _cod_producto; }