I was expecting same thing - views should be treated just as if they were
tables, that's why at first I gave example with table. I thought I was
doing something wrong.
When I switched inserting into a table, without changing convention,
everything was fine.

NH throws error like "null identifier" or "null id" in case of a view. It
doesn't generate sql.

On Wed, Mar 14, 2012 at 6:10 AM, Brad Laney <brad.j.la...@gmail.com> wrote:

> Pretty sure NH doesn't know if its a view or a table.
> NH is a ORM that does not know of the databases existence.
> You tell it what to do and it does it ignoring the settings on the db.
> I have this setup and it works fine. I'll reply with our primary key
> convention tomorrow.
>
> On Tue, Mar 13, 2012 at 4:16 PM, Sofija Blazevski <sosin...@gmail.com>wrote:
>
>> I'm a bit surprised no one answered. Anyway, I just wanted to correct
>> myself, as I actually wanted to insert into a view, not a table. So,
>> conclusion on this is that FluentNHibernate generates correct xml
>> file, but NHibernate doesn't generate expected sql if an insert is
>> made on a view. And that is for both GeneratedBy.Native and
>> GeneratedBy.Identity.
>>
>>
>>
>> On Mar 9, 7:24 pm, Sofija Blazevski <sosin...@gmail.com> wrote:
>> > I'm exploring FluentNHibernate, and I love convention over configuration
>> > and automapping features, but i have a trouble when I want my identity
>> > property not to be in insert sql statement generated. I want primary
>> key to
>> > be assigned by database.
>> >
>> > For example:
>> >
>> > instead of
>> >
>> > insert into Product(ProductId, Name) values (1, 'Test');
>> >
>> > sql generated should be
>> >
>> > insert into Product(Name) values ('Test');
>> >
>> > What I tried is adding convention like
>> >
>> > public class PrimaryKeyConvention : IIdConvention
>> >     {
>> >         public void Apply(IIdentityInstance instance)
>> >         {
>> >             instance.Column(instance.EntityType.Name + "Id");
>> >             *instance.GeneratedBy.Identity();*
>> >         }
>> >     }
>> >
>> > but that doesn't work. Should I use some other interface, or there is
>> > something else needed for this?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Fluent NHibernate" group.
>> To post to this group, send email to fluent-nhibernate@googlegroups.com.
>> To unsubscribe from this group, send email to
>> fluent-nhibernate+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/fluent-nhibernate?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibernate@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to