Note that there are some explanatory texts on larger screens.

plurals
  1. POnhibernate session problem when reading from DB
    primarykey
    data
    text
    <p>I commit some data in DB with nhibernate.</p> <pre><code>TimeSlices newTimeSlices = new TimeSlices(timeSliceStartTime, timeSliceEndTime, schedule, newScheduleDay); tsDao.Save(newTimeSlices); tsDao.CommitChanges(); </code></pre> <p>but then i try to read this data</p> <pre><code>public ScheduleDays GetByDate(DateTime date, Schedules schedule) { NHibernateSession.Refresh(schedule); DateTime tmpDate = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0); return NHibernateSession.CreateCriteria(typeof (ScheduleDays)) .Add(Restrictions.Eq(ScheduleDaysProperties.Date.ToString(), tmpDate)) .Add(Restrictions.Eq(ScheduleDaysProperties.Schedule.ToString(), schedule)) .UniqueResult&lt;ScheduleDays&gt;(); } </code></pre> <p>but without succeed. I look in DB and it is there but i can not read it from DB. How can i refresh session or what i must do that i can read this new data after i save it. Problem is only when i am working with ajax components.</p> <pre><code>public ScheduleDaysMap() { Id(x =&gt; x.ScheduleDayId); Map(x =&gt; x.Date) .Not.Nullable(); Map(x =&gt; x.MinutesOrderInterval) .Not.Nullable(); References(x =&gt; x.Schedule) .Column(TableNames.ScheduleId) .Not.Nullable() .LazyLoad(); HasMany(x =&gt; x.Orders) .KeyColumn(TableNames.ScheduleDayId) .Inverse() .LazyLoad() .AsBag(); HasMany(x =&gt; x.TimeSlices) .KeyColumn(TableNames.ScheduleDayId) .Inverse() .LazyLoad() .AsBag(); Version(x =&gt; x.Timestamp); } </code></pre> <p>timeSliceStartTime, timeSliceEndTime and newTimeSlices are type od DateTime</p> <p>schedule is DB object type (Table Schedules)</p> <p>newScheduleDay is DB object type (Table ScheduleDays)</p> <hr> <p>I am using C# + fluent nhibernate 1.1</p> <p>Can be problem with mapping and lazy load or asbag? Or what can be wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload