-->
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.  [ 3 posts ] 
Author Message
 Post subject: Strange MS Access database problem...
PostPosted: Fri Feb 23, 2007 4:06 am 
Regular
Regular

Joined: Fri Feb 18, 2005 3:34 am
Posts: 88
Location: Poland/Wrocław
Hi,

I have some unrecognized problem... Please someone help me. My question is why the select looks like the one from exception presented below. I don't understand.

I am using NH 1.2B3 and JetDriver. Other stuff works quite well in the project...

Here are my mappings:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
   namespace="TC.Domain"
   assembly="TC.Domain">
   <class name="Work2" table="`Work2`">
      <id name="Id" column="`wr_id`" type="Int32">
         <generator class="native" />
      </id>
      <property name="WrDate" column="`wr_date`" type="DateTime" />
      <many-to-one name="Employee" class="Employee2" />
      <many-to-one name="Task" class="Task2" />
      <property name="WrHours" column="`wr_hours`" type="Single" />
      <property name="WrComment" column="`wr_comment`" type="String(536870910)" />
      <property name="WrApplix" column="`wr_applix`" type="Single" />
      <property name="WrTskApplix" column="`wr_tsk_applix`" type="String(32)" />
      <property name="WrTskAccNum" column="`wr_tsk_acc_num`" type="String(32)" />
      <property name="WrBookingTimestamp" column="`wr_booking_timestamp`" type="DateTime" />
      <property name="WrExportTimestamp" column="`wr_export_timestamp`" type="DateTime" />
   </class>
</hibernate-mapping>


goes together with:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="TC.Domain" assembly="TC.Domain">
   <class name="Employee2" table="`Employee2`">
      <id name="Id" column="`emp_short`" type="String(4)">
         <generator class="assigned" />
      </id>
      <property name="EmpNumber" column="`emp_number`" type="Int32" />
      <property name="EmpName" column="`emp_name`" type="String(50)" />
      <property name="EmpTeam" column="`emp_team`" type="String(9)" />
   </class>
</hibernate-mapping>


And here is how I am trying to get items from Work2:

Code:
         return session.CreateCriteria(typeof(Work2))
            .SetFirstResult(first)
            .SetMaxResults(count)
            .Add(Expression.Eq("Employee", employee))
            .List<Work2>();


But instead of a collectin I get the exception:

Code:
[OleDbException (0x80040e10): No value given for one or more required parameters.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +177
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +56
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +105
   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +91
   System.Data.OleDb.OleDbCommand.ExecuteReader() +6
   NHibernate.JetDriver.JetDbCommand.System.Data.IDbCommand.ExecuteReader() +48
   NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd) +68
   NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session) +271
   NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +280
   NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +83
   NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) +62

[UncategorizedAdoException: Hibernate operation: could not execute query
[ SELECT this_.`wr_id` as wr1_3_0_, this_.`wr_date` as wr2_3_0_, this_.Employee as Employee3_0_, this_.Task as Task3_0_, this_.`wr_hours` as wr5_3_0_, this_.`wr_comment` as wr6_3_0_, this_.`wr_applix` as wr7_3_0_, this_.`wr_tsk_applix` as wr8_3_0_, this_.`wr_tsk_acc_num` as wr9_3_0_, this_.`wr_booking_timestamp` as wr10_3_0_, this_.`wr_export_timestamp` as wr11_3_0_ FROM `Work2` this_ WHERE this_.Employee = ? ]
Positinal Parameters:   0 TC.Domain.Employee2
[SQL: SELECT this_.`wr_id` as wr1_3_0_, this_.`wr_date` as wr2_3_0_, this_.Employee as Employee3_0_, this_.Task as Task3_0_, this_.`wr_hours` as wr5_3_0_, this_.`wr_comment` as wr6_3_0_, this_.`wr_applix` as wr7_3_0_, this_.`wr_tsk_applix` as wr8_3_0_, this_.`wr_tsk_acc_num` as wr9_3_0_, this_.`wr_booking_timestamp` as wr10_3_0_, this_.`wr_export_timestamp` as wr11_3_0_ FROM `Work2` this_ WHERE this_.Employee = ?]; uncategorized DataException for SQL []; ErrorCode [<no error code>]; No value given for one or more required parameters.]
   Spring.Objects.ObjectUtils.InvokeMethod(MethodInfo method, Object instance, Object[] arguments) in c:\Documents and Settings\Roland\Moje dokumenty\SharpDevelop Projects\Lib\Spring.Net\src\Spring\Spring.Core\Objects\ObjectUtils.cs:489
   Spring.Aop.Framework.ReflectiveMethodInvocation.InvokeJoinpoint() in c:\Documents and Settings\Roland\Moje dokumenty\SharpDevelop Projects\Lib\Spring.Net\src\Spring\Spring.Aop\Aop\Framework\ReflectiveMethodInvocation.cs:86
   Spring.Aop.Framework.AbstractMethodInvocation.Proceed() in c:\Documents and Settings\Roland\Moje dokumenty\SharpDevelop Projects\Lib\Spring.Net\src\Spring\Spring.Aop\Aop\Framework\AbstractMethodInvocation.cs:240
   Spring.Transaction.Interceptor.TransactionInterceptor.Invoke(IMethodInvocation invocation) in c:\Documents and Settings\Roland\Moje dokumenty\SharpDevelop Projects\Lib\Spring.Net\src\Spring\Spring.Data\Transaction\Interceptor\TransactionInterceptor.cs:80
   Spring.Aop.Framework.AbstractMethodInvocation.Proceed() in c:\Documents and Settings\Roland\Moje dokumenty\SharpDevelop Projects\Lib\Spring.Net\src\Spring\Spring.Aop\Aop\Framework\AbstractMethodInvocation.cs:263
   Spring.Aop.Framework.DynamicProxy.AdvisedProxy.Invoke(Object proxy, Object target, Type targetType, MethodInfo targetMethod, Object[] args, IList interceptors) in c:\Documents and Settings\Roland\Moje dokumenty\SharpDevelop Projects\Lib\Spring.Net\src\Spring\Spring.Aop\Aop\Framework\DynamicProxy\AdvisedProxy.cs:149
   CompositionAopProxy_452eb7d89f984c8397539fdb3402c9a8.GetItemsByEmployee(Employee2 employee, Int32 first, Int32 count) +230
   TC.WebClient.Default.ctrlEmployee_SelectedIndexChanged(Object sender, EventArgs e) in d:\TC\TC.WebClient\Default.aspx.cs:97
   System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +75
   System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +124
   System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +7
   System.Web.UI.Page.RaiseChangedEvents() +138
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4459

_________________
Please rate this post if you've found it helpfull
Roland


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 23, 2007 4:19 pm 
Regular
Regular

Joined: Sun Jan 21, 2007 4:33 pm
Posts: 65
The quotes you are giving in your mappings (the backquotes) take them out and see how that does? Replace with Double Quotes as needed.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 26, 2007 11:54 am 
Regular
Regular

Joined: Fri Feb 18, 2005 3:34 am
Posts: 88
Location: Poland/Wrocław
Gortok wrote:
The quotes you are giving in your mappings (the backquotes) take them out and see how that does? Replace with Double Quotes as needed.


The quotes are to be handled by the dialect (JetDialect in this case). However I've discoverred that a column specification helped for Employee property mapping. That's because the column name was different from one that the NH could deduce - I am mapping to already existing database...

Thanx anyway :)

_________________
Please rate this post if you've found it helpfull
Roland


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.