I am getting the oracle error ORA12571: TNS: packet writer failure when I run HQL commands but not when I run ICriteria commands.
Example, this works:
return (User) session.CreateCriteria(typeof(User))
.Add(Expression.Eq("LoginId", "mfletche"))
.UniqueResult();
But this does not:
IQuery query = session.CreateQuery("from User u where u.LoginId = :LoginId");
query.SetParameter("LoginId", "mfletche");
return (User) query.UniqueResult();
Hibernate version:
1.0.2
Mapping documents:
<class name="User" table="calendar_user">
<id name="Id" column="user_id1" type="Int64">
<generator class="native" />
</id>
<property name="LoginId" column="login_id1" type="AnsiString" />
</class>
Code between sessionFactory.openSession() and session.close():
IQuery query = session.CreateQuery("from User u where u.LoginId = ?");
query.SetParameter(0, loginId);
return (User) query.UniqueResult();
Full stack trace of any exception that occurs:
[OracleException: ORA-12571: TNS:packet writer failure
]
System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle& rowidDescriptor, ArrayList& refCursorParameterOrdinals)
System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle, CommandBehavior behavior, ArrayList& refCursorParameterOrdinals)
System.Data.OracleClient.OracleCommand.ExecuteReader(CommandBehavior behavior)
System.Data.OracleClient.OracleCommand.ExecuteReader()
System.Data.OracleClient.OracleCommand.System.Data.IDbCommand.ExecuteReader()
NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)
NHibernate.Hql.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters)
NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
[ADOException: Could not execute query]
NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
NHibernate.Impl.QueryImpl.List()
NHibernate.Impl.AbstractQueryImpl.UniqueResult()
PetroCanada.CorpComm.Calendar.DataSession.GetUserSettings(String loginId) in c:\documents and settings\mfletche\desktop\hibernateexample\corpcommcalendar\petrocanada.corpcomm.calendar\datasession.cs:45
PetroCanada.CorpComm.Calendar.Website._Default.PopulateCalendarSelector() in C:\Documents and Settings\mfletche\Desktop\HibernateExample\CorpCommCalendar\PetroCanada.CorpComm.Calendar.Website\Default.aspx.cs:93
PetroCanada.CorpComm.Calendar.Website._Default.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\mfletche\Desktop\HibernateExample\CorpCommCalendar\PetroCanada.CorpComm.Calendar.Website\Default.aspx.cs:43
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
Name and version of the database you are using:
Oracle 9.2
The generated SQL (show_sql=true):
select user0_.user_id as user_id, user0_.login_id as login_id from calendar_user user0_ where (user0_.login_id=:p0)
:p0 = 'mfletche'
Debug level Hibernate log excerpt:
Its too much, ask for a copy if you would like it.
|