I feel like an idiot! The code below does work.
I was copying the NHibernateProvider into the web project's bin folder as a post-build. However, for some reason, the updated dll was not picked up. A restart of IIS Express fixed the issue.
Not sure why this is happening, but the original issue is resolved.
On Wednesday, 24 October 2012 19:53:02 UTC-4, Rasmus wrote:
I am trying to get started with the MyStore sample, but with a PostGres db instead of Sql Server.
When I try to insert a value into the productcategories table, I get the following error:
relation "hibernate_sequence" does not exist
This is the sql that is being generated: INSERT INTO ProductCategories (Id, Name, ProductCategoryFk) VALUES (nextval ('hibernate_sequence'), ((E'Fruits')::text), ((NULL)::int4)) returning Id
I have tried to extend the ProductCategoryOverride class as below:
After the map.Bag section in the Override method, here is what I have added:
map.Id(p => p.Id, i =>
{
i.Column("id");
i.Generator(Generators.Sequence, g => g.Params(new
{
sequence = "productcategories_id_seq",
//sequence = "hibernate_sequence",
//schema = "public",
//catalog = null,
//parameters = null, // driver-specific DDL string to be appended to create command
}));
The problem appears to be that it is not picking up the sequence name I have specified, that exists in the database.
Can anyone tell me what I am doing wrong?