I have the following class
public class Room
{
public virtual Guid Id { get; set }
public virtual string Name { get; set }
public virtual Guid LocId { get; set }
public virtual Location Loc { get; set; }
}
I start transaction and call Session.Save for a new entity and it writes it to the database correctly, but if I immediately call GetList() the list is returned with the Loc property assigned for all entities except for the new entity, but if I set the Loc before calling Save it is assigned for the new entity. Flush() does not solve the problem. What am I missing, I would prefer not to get the Location to set it.
Mapping both
LocandLocIdis an incorrect usage of NHibernate.Use
room.Location = session.Load<Location>(locId)to assign the Location.