I have a similar problem.

However, in my case, the generator try to use a sequence that does not 
exit: “hibernate_sequence”.

This is the offending code:

    [Class(Table= "\"MyTable\"")]
    public class MyClass
    {
        [Id(Column = "id", TypeType = typeof(int))]
        [Generator(Class = "identity")]
        public virtual int Id { get; set; }
        // ....
    }

When I try to save an instance of this class I get the following Exception:

NHibernate.Exceptions.GenericADOException: could not insert: 
[URLShortener.Model.ShortUrlModel][SQL: INSERT INTO "ShortUrls" (id, ... ) 
VALUES (nextval ('hibernate_sequence'), ... ) returning id]
 ---> Npgsql.PostgresException (0x80004005): 42P01: relation 
"hibernate_sequence" does not exist

Because I'm using NHibernate.Mapping.Attributes, I use the “Generator” 
attribute. However, I have no way of defining the name of the sequence used.

Paulo Santos
On Thursday, April 6, 2023 at 4:17:53 PM UTC-3 er.praka...@gmail.com wrote:

> Hi, I am using Postgresql and Nhibernate and in my table I have Identity 
> column. 
> When I try to insert it is not allowing me to insert sysing that Identity 
> column should not be provided in the query while saving data. But I am 
> unable to ignore the that column while insert the Data. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nhusers/fd198a8f-e9f9-46da-bef4-ae6ee0e94bb7n%40googlegroups.com.

Reply via email to