I just reread your initial post... You wrote about a new table. Does that mean that the table definition is not available at the time of the call?
If yes, then make sure that you create the schema before adding rows into it. ActiveRecordStarter.CreateSchema(); -Markus On Tue, May 31, 2011 at 16:16, scottl2001 <[email protected]> wrote: > > I assume you must mean you want to see the StyleImport class, which > inherits from the Castle ActiveRecordBase. Not sure if this will help > you, but here it is... > > > ********************************************************************************************* > > using System; > using System.Collections.Generic; > using System.Text; > using System.Xml.Serialization; > > using Castle.ActiveRecord; > > using StylesApplication.Utility; > > namespace StyleApplication.Data.Models > { > [ActiveRecord, XmlTypeAttribute(AnonymousType = true, Namespace = > "http://www.bcsinet.com/styles")] > > > public class StyleImport : BusinessObject<StyleImport> > { > #region Private Members > > private int _id; > private string _addCustName = string.Empty; > private string _blanksCrossRef = string.Empty; > private string _charWidth = string.Empty; > private string _dateLastPriceChange = string.Empty; > private string _dateLastSold = string.Empty; > > > #endregion > > #region Public Properties > > [PrimaryKey(PrimaryKeyType.Identity), XmlIgnore] > public virtual int ImportID > { > get { return _id; } > set { _id = value; } > } > > > > [Property] > public virtual string AddCustomerName > { > get { return _addCustName; } > set { _addCustName = value; } > } > > [Property] > public virtual string BlanksCrossReference > { > get { return _blanksCrossRef; } > set { _blanksCrossRef = value; } > } > > [Property] > public virtual string CharacterWidthTable > { > get { return _charWidth; } > set { _charWidth = value; } > } > > [Property] > public virtual string DateLastPriceChange > { > get { return _dateLastPriceChange; } > set { _dateLastPriceChange = value; } > } > > [Property] > public virtual string DateLastSoldYYMM > { > get { return _dateLastSold; } > set { _dateLastSold = value; } > } > > #endregion > } > > } > > ********************************************************* > > On May 27, 3:47 pm, Markus Zywitza <[email protected]> wrote: > > Can you post the class please? > > > > > > > > On Fri, May 27, 2011 at 20:43, scottl2001 <[email protected]> > wrote: > > > > > Hello all - > > > > > Having a problem inserting into a new table via Castle/NHibernate. > > > When adding an initial record, it's erroring out, and giving the stack > > > trace listed below. All fields match up viv-a-vis field types, and > > > I'm using the same methods inserting into existing tables, and it > > > works fine. Permissions don't seem to be a problem either. > > > > > Any ideas? > > > > > Thanks! > > > > > > ****************************************************************************** > > > > > Message: > > > Could not perform Create for StyleImport > > > Exception Trace: > > > at Castle.ActiveRecord.ActiveRecordBase.InternalCreate(Object > > > instance, Boolean flush) > > > at Castle.ActiveRecord.ActiveRecordBase.Create(Object instance) > > > at Castle.ActiveRecord.ActiveRecordBase.Create() > > > at StyleApplication.Data.Providers.BaseProvider`1.Add(T record) in > > > C:\development2\In Progress\StylesApplication\StyleApplication.Data > > > \Providers\BaseProvider.cs:line 26 > > > at StyleProcessor.Processor.ProcessImports(ImportCollection > > > imported, String filename) in C:\development2\In Progress > > > \StylesApplication\StyleProcessor\Processor.cs:line 108 > > > > > Inner Exception: > > > could not insert: [StyleApplication.Data.Models.StyleImport][SQL: > > > INSERT INTO StyleImport (AddCustomerName, BlanksCrossReference, > > > CharacterWidthTable, DateLastPriceChange, DateLastSoldYYMM) VALUES > > > (?, ?, ?, ?, ?)] > > > Inner Exception Trace: > > > at > > > NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] > > > fields, Boolean[] notNull, SqlCommandInfo sql, Object obj, > > > ISessionImplementor session) > > > at > > > NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] > > > fields, Object obj, ISessionImplementor session) > > > at NHibernate.Impl.ScheduledIdentityInsertion.Execute() > > > at NHibernate.Impl.SessionImpl.Execute(IExecutable executable) > > > at NHibernate.Impl.SessionImpl.DoSave(Object theObj, EntityKey key, > > > IEntityPersister persister, Boolean replicate, Boolean > > > useIdentityColumn, CascadingAction cascadeAction, Object anything) > > > at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, > > > IEntityPersister persister, Boolean useIdentityColumn, CascadingAction > > > cascadeAction, Object anything) > > > at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object > > > obj, CascadingAction action, Object anything) > > > at NHibernate.Impl.SessionImpl.Save(Object obj) > > > at Castle.ActiveRecord.ActiveRecordBase.InternalCreate(Object > > > instance, Boolean flush) > > > > > *********************************************** > > > > > -- > > > 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.- Hide quoted > text - > > > > - Show quoted text - > > -- > 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. > > -- 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.
