i have made a software with Nhibernate and sqlserver 2005
now i want to connect postgresql8.2
but i am getting fallowing exception
there are only two Files in my project
Interest.cs and Interest.hbm.xml
and Its mapping is
Code:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Business.Entities.Interests,DTO" table='"UserAccounts"."Interests"' lazy="false">
<id name="InterestId" column='"InterestId"' type="int">
<generator class="assigned" />
</id>
<property type="string" name="InterestDesc" column='"InterestDesc"' />
</class>
</hibernate-mapping>
This is my hibernate.config.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
<property name="connection.connection_string">
Server=localhost; port=5433; initial catalog=HibernateExample; User ID=postgres;Password=pakistan;
</property>
<property name="dialect">NHibernate.Dialect.PostgreSQL82Dialect</property>
<mapping assembly="DTO"/>
</session-factory>
</hibernate-configuration>
Code:
13:20:45.234 [4] INFO NHibernate.Cfg.Environment - NHibernate 1.2.1.4000 (1.2.1.4000)
13:20:45.250 [4] INFO NHibernate.Cfg.Environment - nhibernate section not found in application configuration file
13:20:45.265 [4] INFO NHibernate.Cfg.Environment - Bytecode provider name : lcg
13:20:45.265 [4] INFO NHibernate.Cfg.Environment - Using reflection optimizer
13:20:45.312 [4] DEBUG NHibernate.Cfg.Configuration - connection.provider=NHibernate.Connection.DriverConnectionProvider
13:20:45.312 [4] DEBUG NHibernate.Cfg.Configuration - connection.driver_class=NHibernate.Driver.NpgsqlDriver
13:20:45.312 [4] DEBUG NHibernate.Cfg.Configuration - connection.connection_string=
Server=localhost; port=5433; initial catalog=HibernateExample; User ID=postgres;Password=pakistan;
13:20:45.312 [4] DEBUG NHibernate.Cfg.Configuration - dialect=NHibernate.Dialect.PostgreSQL82Dialect
13:20:45.312 [4] DEBUG NHibernate.Cfg.Configuration - <-DTO
13:20:45.312 [4] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: DTO
13:20:45.312 [4] INFO NHibernate.Cfg.Configuration - Mapping resource: DTO.Mappings.Interests.hbm.xml
13:20:45.390 [4] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.PostgreSQL82Dialect
13:20:45.453 [4] INFO NHibernate.Cfg.HbmBinder - Mapping class: Business.Entities.Interests -> "UserAccounts"."Interests"
13:20:45.484 [4] DEBUG NHibernate.Cfg.HbmBinder - Mapped property: InterestId -> "InterestId", type: Int32
13:20:45.500 [4] DEBUG NHibernate.Cfg.HbmBinder - Mapped property: InterestDesc -> "InterestDesc", type: String
13:20:45.500 [4] DEBUG NHibernate.Cfg.Configuration - properties: System.Collections.Hashtable
13:20:45.515 [4] INFO NHibernate.Cfg.Configuration - checking mappings queue
13:20:45.515 [4] INFO NHibernate.Cfg.Configuration - processing one-to-many association mappings
13:20:45.515 [4] INFO NHibernate.Cfg.Configuration - processing one-to-one association property references
13:20:45.515 [4] INFO NHibernate.Cfg.Configuration - processing foreign key constraints
13:20:45.531 [4] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.PostgreSQL82Dialect
13:20:45.531 [4] INFO NHibernate.Connection.ConnectionProviderFactory - Initializing connection provider: NHibernate.Connection.DriverConnectionProvider
13:20:45.531 [4] INFO NHibernate.Connection.ConnectionProvider - Configuring ConnectionProvider
13:20:45.531 [4] INFO NHibernate.Cfg.SettingsFactory - Transaction factory: NHibernate.Transaction.AdoNetTransactionFactory
13:20:45.531 [4] INFO NHibernate.Cfg.SettingsFactory - Optimize cache for minimal puts: False
13:20:45.531 [4] INFO NHibernate.Cfg.SettingsFactory - Connection release mode: auto
13:20:45.531 [4] INFO NHibernate.Cfg.SettingsFactory - Query translator: NHibernate.Hql.Classic.ClassicQueryTranslatorFactory
13:20:45.546 [4] INFO NHibernate.Cfg.SettingsFactory - Query language substitutions: {}
13:20:45.546 [4] INFO NHibernate.Cfg.SettingsFactory - cache provider: NHibernate.Cache.NoCacheProvider, NHibernate, Version=1.2.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
13:20:45.562 [4] INFO NHibernate.Impl.SessionFactoryImpl - building session factory
13:20:45.562 [4] DEBUG NHibernate.Impl.SessionFactoryImpl - instantiating session factory with properties: {connection.connection_string=
Server=localhost; port=5433; initial catalog=HibernateExample; User ID=postgres;Password=pakistan;
, hibernate.connection.connection_string=
Server=localhost; port=5433; initial catalog=HibernateExample; User ID=postgres;Password=pakistan;
, connection.provider=NHibernate.Connection.DriverConnectionProvider, connection.driver_class=NHibernate.Driver.NpgsqlDriver, hibernate.connection.driver_class=NHibernate.Driver.NpgsqlDriver, hibernate.use_reflection_optimizer=true, hibernate.dialect=NHibernate.Dialect.PostgreSQL82Dialect, dialect=NHibernate.Dialect.PostgreSQL82Dialect, hibernate.connection.provider=NHibernate.Connection.DriverConnectionProvider}
13:20:45.687 [4] DEBUG NHibernate.Impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
13:20:45.687 [4] DEBUG NHibernate.Impl.SessionFactoryObjectFactory - registered: b9edaef4cb35466588a0afd14640af55(unnamed)
13:20:45.687 [4] INFO NHibernate.Impl.SessionFactoryObjectFactory - no name configured
13:20:45.796 [4] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.Entities.Interests: SELECT interests0_."InterestId" as column1_0_0_, interests0_."InterestDesc" as column2_0_0_ FROM "UserAccounts"."Interests" interests0_ WHERE interests0_."InterestId"=?
13:20:45.796 [4] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.Entities.Interests: SELECT interests0_."InterestId" as column1_0_0_, interests0_."InterestDesc" as column2_0_0_ FROM "UserAccounts"."Interests" interests0_ WHERE interests0_."InterestId"=?
13:20:45.796 [4] DEBUG NHibernate.SqlCommand.SqlSelectBuilder - The initial capacity was set too low at: 8 for the SelectSqlBuilder that needed a capacity of: 9 for the table "UserAccounts"."Interests" interests0_
13:20:45.796 [4] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.Entities.Interests: SELECT interests0_."InterestId" as column1_0_0_, interests0_."InterestDesc" as column2_0_0_ FROM "UserAccounts"."Interests" interests0_ WHERE interests0_."InterestId"=? for update
13:20:45.796 [4] DEBUG NHibernate.SqlCommand.SqlSelectBuilder - The initial capacity was set too low at: 8 for the SelectSqlBuilder that needed a capacity of: 9 for the table "UserAccounts"."Interests" interests0_
13:20:45.796 [4] DEBUG NHibernate.Loader.Entity.AbstractEntityLoader - Static select for entity Business.Entities.Interests: SELECT interests0_."InterestId" as column1_0_0_, interests0_."InterestDesc" as column2_0_0_ FROM "UserAccounts"."Interests" interests0_ WHERE interests0_."InterestId"=? for update nowait
13:20:45.796 [4] DEBUG NHibernate.Impl.SessionFactoryImpl - Instantiated session factory
13:20:45.812 [4] DEBUG NHibernate.Impl.SessionImpl - opened session
13:20:48.281 [4] DEBUG NHibernate.Impl.SessionImpl - generated identifier: 911
13:20:48.281 [4] DEBUG NHibernate.Impl.SessionImpl - saving [Business.Entities.Interests#911]
13:20:48.546 [4] DEBUG NHibernate.Impl.SessionImpl - flushing session
13:20:48.562 [4] DEBUG NHibernate.Impl.SessionImpl - Flushing entities and processing referenced collections
13:20:48.562 [4] DEBUG NHibernate.Impl.SessionImpl - Processing unreferenced collections
13:20:48.562 [4] DEBUG NHibernate.Impl.SessionImpl - scheduling collection removes/(re)creates/updates
13:20:48.562 [4] DEBUG NHibernate.Impl.SessionImpl - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
13:20:48.562 [4] DEBUG NHibernate.Impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
13:20:48.562 [4] DEBUG NHibernate.Impl.Printer - listing entities:
13:20:48.578 [4] DEBUG NHibernate.Impl.Printer - Business.Entities.Interests{InterestDesc=911 man, InterestId=911}
13:20:48.578 [4] DEBUG NHibernate.Impl.SessionImpl - executing flush
13:20:48.578 [4] DEBUG NHibernate.Impl.ConnectionManager - registering flush begin
13:20:48.578 [4] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister - Inserting entity: [Business.Entities.Interests#911]
13:20:48.640 [4] DEBUG NHibernate.Impl.BatcherImpl - Opened new IDbCommand, open IDbCommands: 1
13:20:48.640 [4] DEBUG NHibernate.Impl.BatcherImpl - Building an IDbCommand object for the SqlString: INSERT INTO "UserAccounts"."Interests" ("InterestDesc", "InterestId") VALUES (?, ?)
13:20:48.640 [4] DEBUG NHibernate.Persister.Entity.AbstractEntityPersister - Dehydrating entity: [Business.Entities.Interests#911]
13:20:48.640 [4] DEBUG NHibernate.Type.StringType - binding '911 man' to parameter: 0
13:20:48.640 [4] DEBUG NHibernate.Type.Int32Type - binding '911' to parameter: 1
13:20:48.640 [4] DEBUG NHibernate.SQL - INSERT INTO "UserAccounts"."Interests" ("InterestDesc", "InterestId") VALUES (:p0, :p1); :p0 = '911 man', :p1 = '911'
13:20:48.640 [4] DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
13:20:48.859 [4] DEBUG NHibernate.Impl.BatcherImpl - Closed IDbCommand, open IDbCommands: 0
13:20:48.859 [4] DEBUG NHibernate.Impl.ConnectionManager - skipping aggressive-release due to flush cycle
13:20:48.875 [4] DEBUG NHibernate.Util.ADOExceptionReporter - could not insert: [Business.Entities.Interests#911] [INSERT INTO "UserAccounts"."Interests" ("InterestDesc", "InterestId") VALUES (?, ?)]
Npgsql.NpgsqlException:
schema "UserAccounts" does not exist
Severity: ERROR
Code: 3F000
at Npgsql.NpgsqlConnector.CheckErrors()
at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications()
at Npgsql.NpgsqlCommand.ExecuteCommand()
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Impl.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
13:20:48.906 [4] WARN NHibernate.Util.ADOExceptionReporter - Npgsql.NpgsqlException:
schema "UserAccounts" does not exist
Severity: ERROR
Code: 3F000
at Npgsql.NpgsqlConnector.CheckErrors()
at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications()
at Npgsql.NpgsqlCommand.ExecuteCommand()
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Impl.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
13:20:48.906 [4] ERROR NHibernate.Util.ADOExceptionReporter - ERROR: 3F000: schema "UserAccounts" does not exist
13:20:48.906 [4] ERROR NHibernate.Impl.SessionImpl - could not synchronize database state with session
NHibernate.ADOException: could not insert: [Business.Entities.Interests#911][SQL: INSERT INTO "UserAccounts"."Interests" ("InterestDesc", "InterestId") VALUES (?, ?)] ---> Npgsql.NpgsqlException:
schema "UserAccounts" does not exist
Severity: ERROR
Code: 3F000
at Npgsql.NpgsqlConnector.CheckErrors()
at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications()
at Npgsql.NpgsqlCommand.ExecuteCommand()
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.Impl.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
--- End of inner exception stack trace ---
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Impl.ScheduledInsertion.Execute()
at NHibernate.Impl.SessionImpl.Execute(IExecutable executable)
at NHibernate.Impl.SessionImpl.ExecuteAll(IList list)
at NHibernate.Impl.SessionImpl.Execute()
13:20:48.921 [4] DEBUG NHibernate.Impl.ConnectionManager - registering flush end
13:20:48.921 [4] DEBUG NHibernate.Impl.ConnectionManager - aggressively releasing database connection
13:20:48.921 [4] DEBUG NHibernate.Connection.ConnectionProvider - Closing connection
Quote:
Looking for Help ... Doing this stuff since long time but didn't get through it :O(