Search code examples
c#nhibernatenpgsql

How to map(NHibernate) a specified PostgreSql type?


I have a PK (character (10)), that is mapped like that:

The load works fine with npgsql 1.0, the sql generated with loadbyid is :

SELECT city0_."IDCity" as IDMu1_92_0_ FROM "tblCity" city0_ WHERE city0_."IDCity"=E'BR420240'

Using npgsql 2.0. the sql generated is :

SELECT city0_."IDCity" as IDMu1_92_0_ FROM "tblCity" city0_ WHERE city0_."IDCity"='BR420240'::text

So, I got ObjectNotFoundException, because that SQL returns 0 results...

Npgsql developer told-me to specify the exact type to the PK, in that case : character(10)...

How can I do that using NH? I tried use sql-type, but I think it only exist in Hibernate...

Thanks


Solution

  • It is a NHibernate bug...