That gives me an XML validation failure when parsing the mappings, I'm
afraid. "XML validation error: The 'default' attribute is not
declared".  Does this mean I'd need to add it into the mapping schema
and then extend hbm2ddl to use it?

Cheers,
John

On Feb 5, 4:53 pm, Tuna Toksoz <[email protected]> wrote:
> Not sure but can you try default="newid()" in the mapping?
>
> Tuna Toksözhttp://tunatoksoz.comhttp://twitter.com/tehlike
>
> Typos included to enhance the readers attention!
>
> On Thu, Feb 5, 2009 at 6:49 PM, John Rayner <[email protected]>wrote:
>
>
>
> > Hello,
>
> > I have a class like this:
> >    public class IndustrySector : IEntity
> >    {
> >        public Guid Id { get; set; }
> >        public string Name { get; set; }
> >    }
>
> > which I map as follows:
> >  <class name="IndustrySector" table="`IndustrySector`"
> > xmlns="urn:nhibernate-mapping-2.2">
> >    <id name="Id" column="Id" type="Guid">
> >       <generator class="guid.comb" />
> >    </id>
> >    <property name="Name" column="Name" length="100" type="String">
> >       <column name="Name" />
> >    </property>
> > </class>
>
> > I'm using hbm2ddl to generate my database schema int MS Sql Server
> > 2005 and it all works well with one exception.  I'd like my database
> > table to have a default value of "newid()" on the Id column.  This
> > would allow me to easily insert data by hand into the tables.  Can
> > hbm2ddl do this for me?  And if so, how?
>
> > TIA,
> > John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to