These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: System.ArgumentException: nhibernate(1.2.0)
PostPosted: Tue Jan 30, 2007 12:53 am 
Newbie

Joined: Thu Jan 25, 2007 4:08 am
Posts: 5
code

config=new Configuration();
config.AddAssembly("NHTrial");
ISessionFactory factory = config.BuildSessionFactory();
ISession session = factory.OpenSession();
JLogin jlogin = (JLogin)session.Load(typeof(JLogin),txtlogin.Text);
string k=jlogin.Password;
Response.Write(k);


primary key is username.
based on username I would like to retrieve other details such as password. when I try to do it I get such exception.
-------------------------------------------------------------------------------------
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported: 'userid'.

Source Error:


Line 85: JLogin jlogin = (JLogin)session.Load(typeof(JLogin),txtlogin.Text);
Line 86:
Line 87: string k=jlogin.Password;
Line 88: Response.Write(k);
Line 89:


Source File: c:\inetpub\wwwroot\trialhibernate\login.aspx.cs Line: 87

Stack Trace:


[ArgumentException: Keyword not supported: 'userid'.]
System.Data.Common.DBConnectionString.ParseInternal(Char[] connectionString, UdlSupport checkForUdl, NameValuePair& keychain)
System.Data.Common.DBConnectionString..ctor(String connectionString, UdlSupport checkForUdl)
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
System.Data.SqlClient.SqlConnectionString.ParseString(String connectionString)
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
NHibernate.Connection.DriverConnectionProvider.GetConnection() in c:\net\nhibernate\nhibernate\src\NHibernate\Connection\DriverConnectionProvider.cs:45
NHibernate.Impl.SessionFactoryImpl.OpenConnection() in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionFactoryImpl.cs:1159

[ADOException: cannot open connection]
NHibernate.Impl.SessionFactoryImpl.OpenConnection() in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionFactoryImpl.cs:1163
NHibernate.Impl.ConnectionManager.Connect() in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\ConnectionManager.cs:53
NHibernate.Impl.ConnectionManager.GetConnection() in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\ConnectionManager.cs:202
NHibernate.Impl.BatcherImpl.Prepare(IDbCommand cmd) in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\BatcherImpl.cs:90
NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd) in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\BatcherImpl.cs:179
NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:1392
NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:417
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:183
NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, Type optionalEntityName, Object optionalIdentifier, IEntityPersister persister) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Loader.cs:1508
NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Entity\AbstractEntityLoader.cs:47
NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object id, Object optionalObject, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Loader\Entity\AbstractEntityLoader.cs:42
NHibernate.Persister.Entity.AbstractEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session) in c:\net\nhibernate\nhibernate\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:2427
NHibernate.Impl.SessionImpl.DoLoad(Type theClass, Object id, Object optionalObject, LockMode lockMode, Boolean checkDeleted) in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionImpl.cs:2767
NHibernate.Impl.SessionImpl.ImmediateLoad(Type clazz, Object id) in c:\net\nhibernate\nhibernate\src\NHibernate\Impl\SessionImpl.cs:2450
NHibernate.Proxy.LazyInitializer.Initialize() in c:\net\nhibernate\nhibernate\src\NHibernate\Proxy\LazyInitializer.cs:89
NHibernate.Proxy.LazyInitializer.GetImplementation() in c:\net\nhibernate\nhibernate\src\NHibernate\Proxy\LazyInitializer.cs:240
NHibernate.Proxy.CastleLazyInitializer.Intercept(IInvocation invocation, Object[] args) in c:\net\nhibernate\nhibernate\src\NHibernate\Proxy\CastleLazyInitializer.cs:59
CProxyTypeNHTrialJLoginNHTrial_NHibernate_ProxyINHibernateProxy1.get_Password() +76
JOBS.WebForm1.btnlogin_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\trialhibernate\login.aspx.cs:87
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 1:00 am 
Beginner
Beginner

Joined: Mon Jan 08, 2007 11:59 pm
Posts: 31
there seems to be some problem in your NH config (connection string). can you check it or post the config information.


Top
 Profile  
 
 Post subject: re:
PostPosted: Tue Jan 30, 2007 1:07 am 
Newbie

Joined: Thu Jan 25, 2007 4:08 am
Posts: 5
samueljob wrote:
there seems to be some problem in your NH config (connection string). can you check it or post the config information.

**************************************************************
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler,System,Version=1.0.5000.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"/>
</configSections>

<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2000Dialect"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="Server=localhost;initial catalog=jobs;
UserID=sa;Password=;Min Pool Size=2"
/>
</nhibernate>


*************************************************************
Jlogin.hbm.xml

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="NHTrial.JLogin,NHTrial" table="jlogin">
<id name="UserName" column="username" type="String(50)">
<generator class="assigned" />
</id>
<property name="Password" column="password" type="String(50)"/>
</class>
</hibernate-mapping>

*************************************************************


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 1:29 am 
Beginner
Beginner

Joined: Mon Jan 08, 2007 11:59 pm
Posts: 31
I think there should be a space between User and ID. try using this:

Code:
<add
key="hibernate.connection.connection_string" value="Server=localhost;Initial catalog=jobs;
User ID=sa;Password=;Min Pool Size=2"
/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.