Ensure you are calling transaction.Commit();

On Mon, 2012-10-29 at 12:02 -0700, graffitiMSX wrote:
> Hi,
> I am trying to save one entity to db using a Transaction,and all the
> selects are being executed normally (and logged in on NHibernate
> Profiler), but when I call Save(entity) the Insert is not being
> generated. My DB is Oracle 11g and the code/mapping follows:
> 
> 
> Config:
> 
> 
> DataAccess.Server = "...";
> DataAccess.Username = "...";
> DataAccess.Password = "...";
> DataAccess.ServiceName = "XE";
> DataAccess.Schema = "...";
> DataAccess.Port = 1521;
> DataAccess.DataBaseType = DatabaseTypeEnum.Oracle10g;
> 
> string connString = String.Format(
>     "user id={0};password={1};data 
> source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST={2})(PORT={3}))(CONNECT_DATA=(SERVICE_NAME={4})))",
>     Username, Password, Server, Port, ServiceName);
>  
> _sessionFactory = Fluently.Configure()
>     .Database(OracleClientConfiguration.Oracle10                        
>          .ConnectionString(c => c.Is(connString))
>         .ShowSql())
> .ExposeConfiguration(c => c.SetProperty("generate_statistics", "true"))
> .Mappings(m => 
> m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
>     .BuildSessionFactory();
> 
> ------------------------------------------------------
> Mapping:
> 
> public RemitMap()
> {
>               Table("EI_REMIT");
>               LazyLoad();
>               Id(x => x.Id)
>                 .Column("ID")
>                 .CustomType("Int32")
>                 .Access.Property()
>                 .CustomSqlType("NUMBER")
>                 .Not.Nullable()
>                 .Precision(38)                
>                 .GeneratedBy.Sequence("EI_REMIT_ID_SEQ");
>               Map(x => x.Sequence)    
>                 .Column("SEQUENCE")
>                 .CustomType("Int32")
>                 .Access.Property()
>                 .Generated.Never()
>                 .CustomSqlType("NUMBER")
>                 .Not.Nullable()
>                 .Precision(38);
>               References(x => x.RemitStatus)
>                 .Class<RemitStatus>()
>                 .Access.Property()
>                 .Cascade.None()
>                 .LazyLoad()
>                 .Columns("EI_REMIT_STATUS_ID");
>               References(x => x.Tag)
>                 .Class<Tag>()
>                 .Access.Property()
>                 .Cascade.None()
>                 .LazyLoad()
>                 .Columns("EI_TAG_ID");
>         }
> }
> ---------------------------------------------------------------------------
> Entity:
> 
> public partial class Remit
> {
>  
>         private Int32 _Id;
>  
>         private Int32 _Sequence;
>  
>         private RemitStatus _RemitStatus;
>  
>         private Tag _Tag;
> 
>         public virtual Int32 Id
>         {
>             get
>             {
>                 return this._Id;
>             }
>             set
>             {
>                 this._Id = value;
>             }
>         }
> 
>         public virtual Int32 Sequence
>         {
>             get
>             {
>                 return this._Sequence;
>             }
>             set
>             {
>                 this._Sequence = value;
>             }
>         }
> 
>         public virtual RemitStatus RemitStatus
>         {
>             get
>             {
>                 return this._RemitStatus;
>             }
>             set
>             {
>                 this._RemitStatus = value;
>             }
>         }
> 
>         public virtual Tag Tag
>         {
>             get
>             {
>                 return this._Tag;
>             }
>             set
>             {
>                 this._Tag = value;
>             }
>         }
> }
> --------------------------------------------------------
> Code:
> 
> Remit remit = new Remit();
> remit.Tag = _tagDao.FindById<Tag>("Id", (Int32)_id);
> remit.RemitStatus = _remitStatusDao.FindById<RemitStatus>("Id", 
> (Int32)_remitStatus.Sent);
> remit.Sequence = _sequence;
> _remitDao.Save(remit);
> 
> --------------------------------------------------------
> 
> That´s all..
> When the 2nd and 3rd lines are being processed, they appear on NHibernate 
> Profiler, but the last line only generates the lines:
> 
> select EI_REMIT_ID_SEQ.nextval
> from   dual
> 
> And nothing else...
> 
> Thanks for your help!
> 
> Rudolf.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Fluent NHibernate" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/fluent-nhibernate/-/vvbI4y2_v2wJ.
> To post to this group, send email to
> fluent-nhibernate@googlegroups.com.
> To unsubscribe from this group, send email to fluent-nhibernate
> +unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to