By first look, all seems ok. Can you try to pinpoint the error by commenting out
- self validation - validation baseclass - all properties - all relations and then readd them one by one? I had a similar error once, but I cannot remember on what occasion. However, it went away when I corrected the mapping... -Markus 2009/7/31 Jason Sznol <[email protected]> > > [ActiveRecord("SaleProperties")] > public class SaleProperty : > ActiveRecordValidationBase<SaleProperty>, IAddressable, > ISalePropertyBindable, IVisible, IPictures, IRooms, IBuildingStyles, > ITaggable, IMLSProperty > { > > #region Private Relation Variables > private Address _address = new Address(); > private IList<BuildingStyle> _styles = new List<BuildingStyle> > (); > private Employee _agent; > private IList<Picture> _pictures = new List<Picture>(); > private IList<Room> _rooms = new List<Room>(); > private IList<CategoryTag> _tags = new List<CategoryTag>(); > #endregion > > #region Constructors > public SaleProperty() > { > Address.State = "CT"; > } > #endregion > > #region ID > [PrimaryKey(PrimaryKeyType.Native, "sale_property_id")] > public virtual int ID { get; set; } > #endregion > > #region Properties > [Property("visible", NotNull = true)] > public virtual bool Visible { get; set; } > > [Property("property_type", Length = 25, NotNull = false)] > public virtual string PropertyType { get; set; } > > //[ValidateDate("Must be a valid date.")] > [Property("date_added", NotNull = true)] > public virtual DateTime DateAdded { get; set; } > > [Property("mls_number", NotNull = false)] > public virtual string MLSNumber { get; set; } > > [ValidateDecimal("List Price must be a decimal in the format > XXXX.XX")] > [Property("list_price", NotNull = false)] > public virtual decimal ListPrice { get; set; } > > [Nested] > public virtual Address Address > { > get { return _address; } > set { _address = value; } > } > > [ValidateInteger("Year built must be an integer value.")] > [Property("year_built", NotNull = false)] > public virtual int YearBuilt { get; set; } > > [ValidateDecimal("Beds must be a decimal in the format XX.X")] > [Property("beds", NotNull = false)] > public virtual decimal Beds { get; set; } > > [ValidateDecimal("Baths must be a decimal in the format > XX.X")] > [Property("baths", NotNull = false)] > public virtual decimal Baths { get; set; } > > [ValidateDecimal("Rooms must be a decimal in the format > XX.X")] > [Property("rooms", NotNull = false)] > public virtual decimal Rooms { get; set; } > > [ValidateDecimal("Taxes must be a decimal in the format > XXXX.X")] > [Property("taxes", NotNull = false)] > public virtual decimal Taxes { get; set; } > > [ValidateDecimal("Acreage must be a decimal in the format > XX.X")] > [Property("estimated_acreage", NotNull = false)] > public virtual decimal EstimatedAcreage { get; set; } > > [Property("owner", NotNull = false, Length=100)] > public virtual string Owner { get; set; } > > [ValidateDecimal("Assessment must be a decimal in the format > XX.X")] > [Property("assessment", NotNull = false)] > public virtual decimal Assessment { get; set; } > > [Property("details", NotNull = false, ColumnType="StringClob", > SqlType = "ntext")] > public virtual string Details { get; set; } > > [ValidateInteger("Square footage must be an integer value.")] > [Property("squarefeet", NotNull = false)] > public virtual int SquareFeet { get; set; } > > [Property("zoning", NotNull = false, Length=255)] > public virtual string Zoning { get; set; } > > [Property("appliances", NotNull = false, Length=255)] > public virtual string Appliances { get; set; } > > [Property("floors", NotNull = false, Length=255)] > public virtual string Floors { get; set; } > > [Property("cooling", NotNull = false, Length=255)] > public virtual string Cooling { get; set; } > > [Property("heating", NotNull = false, Length=255)] > public virtual string Heating { get; set; } > > [Property("fuel", NotNull = false, Length=255)] > public virtual string Fuel { get; set; } > > [Property("water_supply", NotNull = false, Length=255)] > public virtual string WaterSupply { get; set; } > > [Property("basement", NotNull = false, Length=255)] > public virtual string Basement { get; set; } > > [Property("garage", NotNull = false, Length=255)] > public virtual string Garage { get; set; } > > [Property("waste", NotNull= false, Length=255)] > public virtual string Waste { get; set; } > > [Property("interior_features", NotNull = false, Length=500)] > public virtual string InteriorFeatures { get; set; } > > [Property("exteriror_features", NotNull = false, Length=500)] > public virtual string ExteriorFeatures { get; set; } > > [Property("status", NotNull = false, Length = 50)] > public virtual string Status { get; set; } > > [Property("lot_size", NotNull = false)] > public virtual string LotSize { get; set; } > > [Property("num_levels", NotNull = false)] > public virtual int NumberOfLevels { get; set; } > > [Property("listing_date", NotNull=false)] > public virtual DateTime? ListingDate { get; set; } > > [Property("expiration_date", NotNull = false)] > public virtual DateTime? ExpirationDate { get; set; } > > [Property("administrative_comments", NotNull = false, > ColumnType = "StringClob", SqlType = "ntext")] > public virtual string AdministrativeComments { get; set; } > #endregion > > #region Relations > [ValidateNonEmpty("Agent Must Be Set!")] > [BelongsTo("listing_agent", NotNull = false, NotFoundBehaviour > = NotFoundBehaviour.Ignore, Cascade = CascadeEnum.None, > Lazy=FetchWhen.OnInvoke)] > public virtual Employee Agent > { > get { return _agent; } > set { _agent = value; } > } > > [HasAndBelongsToMany(typeof(Picture), Cascade = > ManyRelationCascadeEnum.AllDeleteOrphan, > Inverse=false, Fetch=FetchEnum.Select, > Table="SalePictures", ColumnKey="property_id", > ColumnRef = "picture_id", Lazy=true)] > public virtual IList<Picture> Pictures > { > get { return _pictures; } > set { _pictures = value; } > } > > [HasAndBelongsToMany(typeof(Room), Cascade = > ManyRelationCascadeEnum.AllDeleteOrphan, Table="SaleRooms", > ColumnKey="property_id", ColumnRef="room_id", > RelationType=RelationType.Bag, Lazy=true)] > public virtual IList<Room> RoomDescriptions > { > get { return _rooms; } > set { _rooms = value; } > } > > [HasAndBelongsToMany(typeof(BuildingStyle), > Table="SalePropertyStyles", ColumnKey="property_id", > ColumnRef="style_id", > RelationType=RelationType.Bag, Lazy=true)] > public virtual IList<BuildingStyle> Styles > { > get { return _styles; } > set { _styles = value; } > } > > [BelongsTo("housing_category_id", NotNull=false, > Lazy=FetchWhen.OnInvoke)] > public virtual HousingCategory Category { get; set; } > > [HasAndBelongsToMany(typeof(CategoryTag), Table = "SaleTags", > ColumnKey = "property_id", ColumnRef = "tag_id", > RelationType = RelationType.Bag, Lazy=true)] > public virtual IList<CategoryTag> Tags > { > get { return _tags; } > set { _tags = value; } > } > #endregion > > #region Methods > public new static int Count() > { > CountQuery cq = new CountQuery(typeof(SaleProperty)); > return (int)ActiveRecordMediator.ExecuteQuery(cq); > } > public new static int Count(DetachedCriteria dc) > { > CountQuery cq = new CountQuery(typeof(SaleProperty), dc); > return (int)ActiveRecordMediator.ExecuteQuery(cq); > } > #endregion > > #region Validate Address Unique > [ValidateSelf(RunWhen=RunWhen.Insert)] > public virtual void Validate(ErrorSummary errorSummary) > { > if (Exists(Restrictions.Conjunction().Add(Restrictions.Eq > ("Address.Street", Address.Street)) > .Add(Restrictions.Or > (Restrictions.Eq("Address.Street2", Address.Street2), > Restrictions.IsNull("Address.Street2"))) > .Add(Restrictions.Or > (Restrictions.Eq("Address.ApartmentNumber", Address.ApartmentNumber), > Restrictions.IsNull("Address.ApartmentNumber"))) > .Add(Restrictions.Eq > ("Address.Town", Address.Town)))) > errorSummary.RegisterErrorMessage("Address", "Address > already exists in database!"); > } > #endregion > } > > > On Jul 31, 2:37 pm, Markus Zywitza <[email protected]> wrote: > > Can you post details on the type? > > > > -Markus > > > > 2009/7/31 Jason Sznol <[email protected]> > > > > > > > > > Hello all, I've been racking my brain on this problem for a few days. > > > I have the following error messages in my logs and I'm completely > > > baffled as to why they are occurring: > > > > > 20:26:26 [6] ERROR NHibernate.AssertionFailure - An AssertionFailure > > > occurred - this may indicate a bug in NHibernate or in your custom > > > types. > > > > > NHibernate.AssertionFailure: null id in Westshore.Models.SaleProperty > > > entry (don't flush the Session after an exception occurs) > > > > > Basically when I call the Create() function on my models they will not > > > persist back to the database and throws the following exception on the > > > Create() function. From what I've read on the internet I believe this > > > is usually some sort of validation problem with the models; however, > > > all the data I've inputted is valid when I create it and the model's > > > properties are all getting set properly. The ID column is a Native ID > > > which uses an Identity column in SQL 2005. > > > > > This is using a trunk build of Activerecord built on June 29th. There > > > is some code change I must have made to break the model but I can't > > > pinpoint what it is. Any help will be greatly appreciated. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
