带有nHibernate(.net,pgsql)的PostgreSQL查询错误
我正在尝试从PostgreSQL db中获取所有电影的列表,如下所示:带有nHibernate(.net,pgsql)的PostgreSQL查询错误,nhibernate,postgresql,Nhibernate,Postgresql,我正在尝试从PostgreSQL db中获取所有电影的列表,如下所示: IQuery query = session.CreateQuery("FROM Movie"); 但是得到这个错误:错误:42P01:关系“电影”不存在 下面是我在pgAdminIII中使用的一个查询,它可以正常工作 SELECT "Movies"."Id", "Movies"."Title", "Movies"."Director", "Movies"."ReleaseDate" FROM
IQuery query = session.CreateQuery("FROM Movie");
但是得到这个错误:错误:42P01:关系“电影”不存在
下面是我在pgAdminIII中使用的一个查询,它可以正常工作
SELECT
"Movies"."Id",
"Movies"."Title",
"Movies"."Director",
"Movies"."ReleaseDate"
FROM
public."Movies";
从nHibernate生成的查询似乎不正确。这是web.config设置
<configSections>
<section name="hibernate-configuration" requirePermission="false" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="NHibernate.Test">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
<property name="connection.connection_string">Server=localhost;database=Movies;User ID=movie;Password=password;</property>
<property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
</session-factory>
</hibernate-configuration>
NHibernate.Connection.DriverConnectionProvider
NHibernate.Driver.NpgsqlDriver
服务器=本地主机;数据库=电影;用户ID=电影;密码=密码;
NHibernate.dialogue.Postgresqldialogue
NHibernate.ByteCode.Castle.proxyFactory,NHibernate.ByteCode.Castle
有什么想法吗?看看错误: 错误:42P01:关系“movies”不存在 不存在 这是小写电影,而不是双引号(!)之间的大写电影,正如您在SQL中使用的那样。PostgreSQL使用小写,或者必须使用双引号
建议:数据库中的对象名始终使用小写。如果需要保留大小写混合的名称,请将对象名用倒钩(``)括起来。倒钩?这是MySQL的东西,在任何其他数据库中都不起作用。如果需要,可以使用ANSI-SQL双引号,就像上面的示例一样。