We have a class Salespoint which is contained within a SalespointDocument in RavenDB. When I try to create the following index:
public class GroupInfoIndex: AbstractIndexCreationTask<SalespointDocument, SalespointGroupTimestampTuple>
{
public GroupInfoIndex()
{
Map = salespoints => from s in salespoints
select new
{
SalespointId = s.Salespoint.SalespointSimplePropertiesData.SalespointId,
DistributorId = s.Salespoint.SalespointSimplePropertiesData.DistributorId,
AgentId = s.Salespoint.SalespointSimplePropertiesData.AgentId,
Timestamp = s.TimeStamp
};
}
}
and query it like thusly:
myDocumentSession.Query<SalespointGroupTimestampTuple>("GroupInfoIndex").ToList()
I never get any data.
When I look at the RavenDB silverlight client I see that the query is persisted like this:
docs.SalespointDocuments
.Select(s => new {SalespointId = s.Salespoint.SalespointSimplePropertiesData.SalespointId, DistributorId = s.Salespoint.SalespointSimplePropertiesData.DistributorId, AgentId = s.Salespoint.SalespointSimplePropertiesData.AgentId, Timestamp = s.TimeStamp})
but when I try to execute the query in the RavenDB silverlight client, I get the following error:
Lucene.Net.QueryParsers.ParseException: Cannot parse 'docs.SalespointDocuments
.Select(s => new {SalespointId = s.Salespoint.SalespointSimplePropertiesData.SalespointId, DistributorId = s.Salespoint.SalespointSimplePropertiesData.DistributorId, AgentId = s.Salespoint.SalespointSimplePropertiesData.AgentId, Timestamp = s.TimeStamp})': Encountered " "s.Salespoint.SalespointSimplePropertiesData.SalespointId, "" at line 1, column 60.
Was expecting:
"}" ...
---> Lucene.Net.QueryParsers.ParseException: Encountered " "s.Salespoint.SalespointSimplePropertiesData.SalespointId, "" at line 1, column 60.
Was expecting:
"}" ...
at Lucene.Net.QueryParsers.QueryParser.Jj_consume_token(Int32 kind) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 2130
at Lucene.Net.QueryParsers.QueryParser.Term(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1884
at Lucene.Net.QueryParsers.QueryParser.Clause(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1588
at Lucene.Net.QueryParsers.QueryParser.Query(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1524
at Lucene.Net.QueryParsers.QueryParser.Clause(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1593
at Lucene.Net.QueryParsers.QueryParser.Query(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1524
at Lucene.Net.QueryParsers.QueryParser.Parse(String query) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 232
--- End of inner exception stack trace ---
at Lucene.Net.QueryParsers.QueryParser.Parse(String query) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 250
at Raven.Database.Indexing.QueryBuilder.BuildQuery(String query, PerFieldAnalyzerWrapper analyzer) in c:\Builds\raven\Raven.Database\Indexing\QueryBuilder.cs:line 30
at Raven.Database.Indexing.Index.IndexQueryOperation.GetLuceneQuery() in c:\Builds\raven\Raven.Database\Indexing\Index.cs:line 723
at Raven.Database.Indexing.Index.IndexQueryOperation.d_24.MoveNext() in c:\Builds\raven\Raven.Database\Indexing\Index.cs:line 581
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection)
at Raven.Database.DocumentDatabase.<>c_DisplayClass72.b__6a(IStorageActionsAccessor actions) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:line 762
at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action1 action) in c:\Builds\raven\Raven.Storage.Esent\TransactionalStorage.cs:line 379
at Raven.Storage.Esent.TransactionalStorage.Batch(Action1 action) in c:\Builds\raven\Raven.Storage.Esent\TransactionalStorage.cs:line 340
at Raven.Database.DocumentDatabase.Query(String index, IndexQuery query) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:line 707
at Raven.Database.Server.Responders.Index.PerformQueryAgainstExistingIndex(IHttpContext context, String index, IndexQuery indexQuery, Guid& indexEtag) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 178
at Raven.Database.Server.Responders.Index.ExecuteQuery(IHttpContext context, String index, Guid& indexEtag) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 164
at Raven.Database.Server.Responders.Index.GetIndexQueryRessult(IHttpContext context, String index) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 120
at Raven.Database.Server.Responders.Index.OnGet(IHttpContext context, String index) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 94
at Raven.Database.Server.Responders.Index.Respond(IHttpContext context) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 46
at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 477
at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 259
System.Net.WebException: Lucene.Net.QueryParsers.ParseException: Cannot parse 'docs.SalespointDocuments
.Select(s => new {SalespointId = s.Salespoint.SalespointSimplePropertiesData.SalespointId, DistributorId = s.Salespoint.SalespointSimplePropertiesData.DistributorId, AgentId = s.Salespoint.SalespointSimplePropertiesData.AgentId, Timestamp = s.TimeStamp})': Encountered " "s.Salespoint.SalespointSimplePropertiesData.SalespointId, "" at line 1, column 60.
Was expecting:
"}" ...
---> Lucene.Net.QueryParsers.ParseException: Encountered " "s.Salespoint.SalespointSimplePropertiesData.SalespointId, "" at line 1, column 60.
Was expecting:
"}" ...
at Lucene.Net.QueryParsers.QueryParser.Jj_consume_token(Int32 kind) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 2130
at Lucene.Net.QueryParsers.QueryParser.Term(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1884
at Lucene.Net.QueryParsers.QueryParser.Clause(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1588
at Lucene.Net.QueryParsers.QueryParser.Query(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1524
at Lucene.Net.QueryParsers.QueryParser.Clause(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1593
at Lucene.Net.QueryParsers.QueryParser.Query(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1524
at Lucene.Net.QueryParsers.QueryParser.Parse(String query) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 232
--- End of inner exception stack trace ---
at Lucene.Net.QueryParsers.QueryParser.Parse(String query) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 250
at Raven.Database.Indexing.QueryBuilder.BuildQuery(String query, PerFieldAnalyzerWrapper analyzer) in c:\Builds\raven\Raven.Database\Indexing\QueryBuilder.cs:line 30
at Raven.Database.Indexing.Index.IndexQueryOperation.GetLuceneQuery() in c:\Builds\raven\Raven.Database\Indexing\Index.cs:line 723
at Raven.Database.Indexing.Index.IndexQueryOperation.d_24.MoveNext() in c:\Builds\raven\Raven.Database\Indexing\Index.cs:line 581
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection)
at Raven.Database.DocumentDatabase.<>c_DisplayClass72.b_6a(IStorageActionsAccessor actions) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:line 762
at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action1 action) in c:\Builds\raven\Raven.Storage.Esent\TransactionalStorage.cs:line 379
at Raven.Storage.Esent.TransactionalStorage.Batch(Action1 action) in c:\Builds\raven\Raven.Storage.Esent\TransactionalStorage.cs:line 340
at Raven.Database.DocumentDatabase.Query(String index, IndexQuery query) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:line 707
at Raven.Database.Server.Responders.Index.PerformQueryAgainstExistingIndex(IHttpContext context, String index, IndexQuery indexQuery, Guid& indexEtag) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 178
at Raven.Database.Server.Responders.Index.ExecuteQuery(IHttpContext context, String index, Guid& indexEtag) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 164
at Raven.Database.Server.Responders.Index.GetIndexQueryRessult(IHttpContext context, String index) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 120
at Raven.Database.Server.Responders.Index.OnGet(IHttpContext context, String index) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 94
at Raven.Database.Server.Responders.Index.Respond(IHttpContext context) in c:\Builds\raven\Raven.Database\Server\Responders\Index.cs:line 46
at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 477
at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\raven\Raven.Database\Server\HttpServer.cs:line 259
at Raven.Client.Silverlight.Connection.Async.AsyncServerClient.HandleException(WebException e)
at Raven.Client.Silverlight.Connection.Async.AsyncServerClient.AttemptToProcessResponse[T](Func1 process)
at Raven.Client.Silverlight.Connection.Async.AsyncServerClient.<>c__DisplayClass2a.<QueryAsync>b__27(Task1 task)
at System.Threading.Tasks.Task1.<>c__DisplayClass1a1.b_19()
at System.Threading.Tasks.Task`1.InvokeFuture(Object futureAsObj)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
Inner StackTrace:
at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent, Action`1 action)
at Raven.Studio.Features.Query.ExecuteQueryCommand.GetFetchDocumentsMethod(DocumentsModel documentsModel)
at Raven.Studio.Models.DocumentsModel.TimerTickedAsync()
at Raven.Studio.Infrastructure.Model.TimerTicked()
at Raven.Studio.Infrastructure.Model.ForceTimerTicked()
at Raven.Studio.Features.Query.ExecuteQueryCommand.Execute(Object _)
at Raven.Studio.Models.QueryModel.RestoreHistory()
at Raven.Studio.Models.QueryModel.set_IndexName(String value)
at Raven.Studio.Models.QueryModel.LoadModelParameters(String parameters)
at Raven.Studio.Infrastructure.ViewModel.LoadModel(String state)
at Raven.Studio.Infrastructure.ModelAttacher.<>c_DisplayClass1.b_0(Object sender, RoutedEventArgs eventArgs)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
What is the problem?
Related
Since upgrading to Apache.Ignite 2.12.0, Ignite fails to start up with the following error:
Unhandled exception. Apache.Ignite.Core.Common.IgniteException: Failed to start Ignite.NET, check inner exception for details
System.ArgumentException: Seek before origin: -1953261975
at Apache.Ignite.Core.Impl.Memory.PlatformMemoryStream.Seek(Int32 offset, SeekOrigin origin)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadHandleObject[T](Int32 pos, Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Read[T](Func`1 readFunc, Byte expHdr)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Read[T](Func`2 readFunc, Byte expHdr)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadString()
at Apache.Ignite.Core.Configuration.DataRegionConfiguration..ctor(IBinaryRawReader reader)
at Apache.Ignite.Core.Configuration.DataStorageConfiguration.<>c__DisplayClass27_0.<.ctor>b__0(Int32 x)
at System.Linq.Enumerable.SelectRangeIterator`1.ToArray()
at Apache.Ignite.Core.Configuration.DataStorageConfiguration..ctor(IBinaryRawReader reader)
at Apache.Ignite.Core.IgniteConfiguration.ReadCore(BinaryReader r)
at Apache.Ignite.Core.IgniteConfiguration.Read(BinaryReader binaryReader)
at Apache.Ignite.Core.IgniteConfiguration..ctor(BinaryReader binaryReader, IgniteConfiguration baseConfig)
at Apache.Ignite.Core.Impl.Ignite.<GetConfiguration>b__87_0(IBinaryStream s)
at Apache.Ignite.Core.Impl.PlatformJniTarget.OutStream[T](Int32 type, Func`2 readAction)
at Apache.Ignite.Core.Impl.PlatformTargetAdapter.DoInOp[T](Int32 type, Func`2 action)
at Apache.Ignite.Core.Impl.Ignite.GetConfiguration()
at Apache.Ignite.Core.Impl.Ignite.SetCompactFooter()
at Apache.Ignite.Core.Impl.Ignite..ctor(IgniteConfiguration cfg, String name, IPlatformTargetInternal proc, Marshaller marsh, IList`1 lifecycleHandlers, UnmanagedCallbacks cbs)
at Apache.Ignite.Core.Ignition.OnStart(GlobalRef interopProc, IBinaryStream stream)
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.OnStart(Int64 memPtr, Int64 unused, Int64 unused1, Void* proc)
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.InLongLongLongObjectOutLong(Int32 type, Int64 val1, Int64 val2, Int64 val3, IntPtr arg)
at Apache.Ignite.Core.Impl.Unmanaged.Jni.Callbacks.InLongLongLongObjectOutLong(IntPtr env, IntPtr clazz, Int64 igniteId, Int32 op, Int64 arg1, Int64 arg2, Int64 arg3, IntPtr arg)
Any assistance would be appreciated
When I use UPDATE query to update a value to NUMBER datatype field i get data type mismatch error
my code :
com.CommandText = "UPDATE register SET price_reg=#price_reg,rprice_reg=#rprice_reg,ipprice_reg=#ipprice_reg,mprice_reg=#mprice_reg,totalp_reg=#totalp_reg,operatormali_reg=#operatormali_reg,noedaryaft_reg=#noedaryaft_reg,datedaryaft_reg=#datedaryaft_reg WHERE id_reg='" & Label58.Text & "' "
com.Parameters.AddWithValue("#price_reg", TextBox12.Text)
com.Parameters.AddWithValue("#rprice_reg", TextBox11.Text)
com.Parameters.AddWithValue("#ipprice_reg", TextBox13.Text)
com.Parameters.AddWithValue("#mprice_reg", TextBox14.Text)
com.Parameters.AddWithValue("#totalp_reg", TextBox15.Text)
com.Parameters.AddWithValue("#operatormali_reg", username)
com.Parameters.AddWithValue("#noedaryaft_reg", ComboBox1.Text)
com.Parameters.AddWithValue("#datedaryaft_reg", TextBox16.Text)
com.ExecuteNonQuery()
5 first parameter is NUMBER datatype in my access database
i try this for send parameters too :
com.Parameters.AddWithValue("#price_reg", convert.toint32(TextBox12.Text))
also i try this :
com.Parameters.AddWithValue("#price_reg", Cdec(TextBox12.Text))
also i try add :
com.CommandText = "UPDATE register SET price_reg=#price_reg,rprice_reg=#rprice_reg,ipprice_reg=#ipprice_reg,mprice_reg=#mprice_reg,totalp_reg=#totalp_reg,operatormali_reg=#operatormali_reg,noedaryaft_reg=#noedaryaft_reg,datedaryaft_reg=#datedaryaft_reg WHERE id_reg='" & Label58.Text & "' "
com.Parameters.Add("#price_reg", OleDbType.Integer)
com.Parameters("#price_reg").Value = CInt(TextBox12.Text)
com.Parameters.Add("#rprice_reg", OleDbType.Integer)
com.Parameters("#rprice_reg").Value = CInt(TextBox11.Text)
com.Parameters.Add("#ipprice_reg", OleDbType.Integer)
com.Parameters("#ipprice_reg").Value = CInt(TextBox13.Text)
com.Parameters.Add("#mprice_reg", OleDbType.Integer)
com.Parameters("#mprice_reg").Value = CInt(TextBox14.Text)
com.Parameters.Add("#totalp_reg", OleDbType.Integer)
com.Parameters("#totalp_reg").Value = CInt(TextBox15.Text)
com.Parameters.AddWithValue("#operatormali_reg", username)
com.Parameters.AddWithValue("#noedaryaft_reg", ComboBox1.Text)
com.Parameters.AddWithValue("#datedaryaft_reg", TextBox16.Text)
com.ExecuteNonQuery()
but same error
error msg :
System.Data.OleDb.OleDbException was unhandled
ErrorCode=-2147217913
Message="Data type mismatch in criteria expression."
Source="Microsoft JET Database Engine"
StackTrace:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at asiatech_managment.Form1.ToolStripButton23_Click(Object sender, EventArgs e) in C:\Users\pc1\Documents\Visual Studio 2008\Projects\asiatech-managment\asiatech-managment\Form1.vb:line 360 at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at asiatech_managment.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException:
thanks for your answers
The error said
Message="Data type mismatch in criteria expression."
My Question is what is the datatype of your id_reg? is it an INT? if yes then do something like this.
change your
WHERE id_reg='" & Label58.Text & "' "
to
WHERE id_reg=" & Label58.Text
Using Orchard.Projections module, it's not possible to search in Unicode text. For example the result query is Select ... From ... Where ... Col Like '%term%' but we expected Select ... From ... Where ... Col Like N'%term%' (N included after Like). Looking it up in code we find public static BinaryExpression Like() in Orchard.ContentManagement.HqlRestrictions. By adding N and changing value = "'%" + FormatValue(value, false) + "%'"; into value = "N'%" + FormatValue(value, false) + "%'"; we get this error:
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException was caught
HResult=-2146232832
Message=Exception of type 'Antlr.Runtime.MismatchedTokenException' was thrown. near line 9, column 61
Source=NHibernate
StackTrace:
at NHibernate.Hql.Ast.ANTLR.ErrorCounter.ThrowQueryException() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Hql\Ast\ANTLR\ErrorCounter.cs:line 73
at NHibernate.Hql.Ast.ANTLR.HqlParseEngine.Parse() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Hql\Ast\ANTLR\QueryTranslatorImpl.cs:line 479
at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String queryString, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs:line 19
at NHibernate.Engine.Query.HQLStringQueryPlan.CreateTranslators(String hql, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Engine\Query\HQLStringQueryPlan.cs:line 24
at NHibernate.Engine.Query.HQLStringQueryPlan..ctor(String hql, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Engine\Query\HQLStringQueryPlan.cs:line 16
at NHibernate.Engine.Query.HQLStringQueryPlan..ctor(String hql, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Engine\Query\HQLStringQueryPlan.cs:line 14
at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String queryString, Boolean shallow, IDictionary`2 enabledFilters) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Engine\Query\QueryPlanCache.cs:line 62
at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String query, Boolean shallow) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\AbstractSessionImpl.cs:line 310
at NHibernate.Impl.AbstractSessionImpl.CreateQuery(String queryString) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\AbstractSessionImpl.cs:line 289
at Orchard.ContentManagement.DefaultHqlQuery.Slice(Int32 skip, Int32 count) in d:\Projects\...\src\Orchard\ContentManagement\DefaultHqlQuery.cs:line 188
at Orchard.Projections.Services.ProjectionManager.GetContentItems(Int32 queryId, Int32 skip, Int32 count)
at Orchard.Projections.Drivers.ProjectionPartDriver.<>c__DisplayClass2e.<Display>b__1e(Object shape)
at Orchard.ContentManagement.Drivers.ContentPartDriver`1.<>c__DisplayClass12.<ContentShape>b__11(BuildShapeContext ctx) in d:\Projects\...\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 135
at Orchard.ContentManagement.Drivers.ContentPartDriver`1.<>c__DisplayClass15.<ContentShapeImplementation>b__14(BuildShapeContext ctx) in d:\Projects\...\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 140
at Orchard.ContentManagement.Drivers.ContentShapeResult.ApplyImplementation(BuildShapeContext context, String displayType) in d:\Projects\...\src\Orchard\ContentManagement\Drivers\ContentShapeResult.cs:line 45
at Orchard.ContentManagement.Drivers.ContentShapeResult.Apply(BuildDisplayContext context) in d:\Projects\...\src\Orchard\ContentManagement\Drivers\ContentShapeResult.cs:line 21
at Orchard.ContentManagement.Drivers.CombinedResult.Apply(BuildDisplayContext context) in d:\Projects\...\src\Orchard\ContentManagement\Drivers\CombinedResult.cs:line 28
at Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator.<>c__DisplayClassa.<BuildDisplay>b__9(IContentPartDriver driver) in d:\Projects\...\src\Orchard\ContentManagement\Drivers\Coordinators\ContentPartDriverCoordinator.cs:line 49
at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in d:\Projects\...\src\Orchard\InvokeExtensions.cs:line 17
InnerException:
line 9, column 61 indicates the position of 'N'.
Any idea?
How can we use this module to search in unicode text without changing database collation?
Orchard version is 1.8.1
Quick fix. I've changed collation setting directly of database
I've a problem with following Hql Query:
FROM PhysikalischesObjekt physikalischesObjekt LEFT OUTER JOIN FETCH physikalischesobjekt.AktuelleInstallation installation
As you see - i'm using aliases that named like the entity (just with lower letter at the first position).
If im execute this query to Nhibernate, i get a InvalidPathException:
NHibernate.Hql.Ast.ANTLR.InvalidPathException : Invalid path: 'physikalischesobjekt.AktuelleInstallation' [FROM PhysikalischesObjekt physikalischesObjekt LEFT OUTER JOIN FETCH physikalischesobjekt.AktuelleInstallation installation ]
Stacktrace:
> NHibernate.dll!NHibernate.Hql.Ast.ANTLR.Util.LiteralProcessor.LookupConstant(NHibernate.Hql.Ast.ANTLR.Tree.DotNode node) Zeile 81 C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.Tree.DotNode.Resolve(bool generateJoin, bool implicitJoin, string classAlias, NHibernate.Hql.Ast.ANTLR.Tree.IASTNode parent) Zeile 208 C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.Tree.FromReferenceNode.Resolve(bool generateJoin, bool implicitJoin, string classAlias) Zeile 58 C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.CreateFromJoinElement(NHibernate.Hql.Ast.ANTLR.Tree.IASTNode path, NHibernate.Hql.Ast.ANTLR.Tree.IASTNode alias, int joinType, NHibernate.Hql.Ast.ANTLR.Tree.IASTNode fetchNode, NHibernate.Hql.Ast.ANTLR.Tree.IASTNode propertyFetch, NHibernate.Hql.Ast.ANTLR.Tree.IASTNode with) Zeile 681 C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.joinElement() Zeile 3955 + 0x3c Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.fromElement() Zeile 3617 + 0xc Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.fromElementList() Zeile 3391 + 0xc Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.fromClause() Zeile 3308 + 0xc Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.unionedQuery() Zeile 1645 + 0xc Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.query() Zeile 1510 + 0xc Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.selectStatement() Zeile 536 + 0xc Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.statement() Zeile 435 + 0xc Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.HqlSqlTranslator.Translate() Zeile 590 + 0x1b Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Analyze(string collectionRole) Zeile 449 + 0x12 Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(System.Collections.Generic.IDictionary<string,string> replacements, bool shallow, string collectionRole) Zeile 354 + 0x13 Bytes C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Compile(System.Collections.Generic.IDictionary<string,string> replacements, bool shallow) Zeile 72 C#
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(NHibernate.Hql.Ast.ANTLR.Tree.IASTNode ast, string queryIdentifier, string collectionRole, bool shallow, System.Collections.Generic.IDictionary<string,NHibernate.IFilter> filters, NHibernate.Engine.ISessionFactoryImplementor factory) Zeile 43 + 0xa3 Bytes Unknown
NHibernate.dll!NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(string queryString, string collectionRole, bool shallow, System.Collections.Generic.IDictionary<string,NHibernate.IFilter> filters, NHibernate.Engine.ISessionFactoryImplementor factory) Zeile 21 + 0x3a Bytes C#
NHibernate.dll!NHibernate.Engine.Query.HQLStringQueryPlan.CreateTranslators(string hql, string collectionRole, bool shallow, System.Collections.Generic.IDictionary<string,NHibernate.IFilter> enabledFilters, NHibernate.Engine.ISessionFactoryImplementor factory) Zeile 24 + 0x99 Bytes C#
NHibernate.dll!NHibernate.Engine.Query.HQLStringQueryPlan.HQLStringQueryPlan(string hql, string collectionRole, bool shallow, System.Collections.Generic.IDictionary<string,NHibernate.IFilter> enabledFilters, NHibernate.Engine.ISessionFactoryImplementor factory) Zeile 16 + 0x3e Bytes C#
NHibernate.dll!NHibernate.Engine.Query.HQLStringQueryPlan.HQLStringQueryPlan(string hql, bool shallow, System.Collections.Generic.IDictionary<string,NHibernate.IFilter> enabledFilters, NHibernate.Engine.ISessionFactoryImplementor factory) Zeile 14 C#
NHibernate.dll!NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(string queryString, bool shallow, System.Collections.Generic.IDictionary<string,NHibernate.IFilter> enabledFilters) Zeile 61 + 0x5b Bytes C#
NHibernate.dll!NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(string query, bool shallow) Zeile 304 + 0x87 Bytes C#
NHibernate.dll!NHibernate.Impl.AbstractSessionImpl.CreateQuery(string queryString) Zeile 283 + 0x3b Bytes C#
Is there a problem using alias like this in Hql? Is there a Syntax that disallows to use the same alias name as the entity name? It seems that Nhibernate tries find a persister for the alias name which doesn't work, obviously.
The alias you used are not the same: "physikalischesObjekt" and "physikalisachesobjekt".
Continuation to the previous question, I tried to avoid the problem another way:
Just for the reminder:
My database schema is described below:
Form <-> Log
<--->>Seller1
<--->>Seller2
<--->>Seller3
I have a major entity (Form), one to
one relationship to another object
(Log) And one to many relationship to
the childs (Sellers).
I want to pull out all the Forms that
one of their Sellers meets certain
conditions.
I tried like this now:
[Test]
public void Can_Get_Forms_Where_CorporationNumber_Is_510778087_Metohd1()
{
var CorporationNumber = "513514950";
var list1 = sellerRepository
.Where(x => x.CorporationNumber == CorporationNumber)
.Select(x => x.Form)
.Fetch(x => x.Log)
.Take(10).ToList();
CollectionAssert.IsNotEmpty(list1);
}
But unfortunately I get NullReferenceException:
TestUsingDevelopmentDataBase.Moch.BillOfSale.Data.FormRepositoryTests.Can_Get_Forms_Where_CorporationNumber_Is_510778087_Metohd1:
System.NullReferenceException : Object
reference not set to an instance of an
object
EDIT: stacktrace:
at
NHibernate.Linq.Visitors.ResultOperatorProcessors.ProcessFetch.Process(FetchRequestBase
resultOperator, QueryModelVisitor
queryModelVisitor, IntermediateHqlTree
tree) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\Visitors\ResultOperatorProcessors\ProcessFetch.cs:line
11 at
NHibernate.Linq.Visitors.ResultOperatorProcessors.ProcessFetchOne.Process(FetchOneRequest
resultOperator, QueryModelVisitor
queryModelVisitor, IntermediateHqlTree
tree) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\Visitors\ResultOperatorProcessors\ProcessFetchOne.cs:line
9 at
NHibernate.Linq.Visitors.ResultOperatorProcessors.ResultOperatorProcessor1.Process(ResultOperatorBase
resultOperator, QueryModelVisitor
queryModel, IntermediateHqlTree tree)
in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\Visitors\ResultOperatorProcessors\ResultOperatorProcessor.cs:line
17 at
NHibernate.Linq.Visitors.ResultOperatorProcessors.ResultOperatorMap.Process(ResultOperatorBase
resultOperator, QueryModelVisitor
queryModel, IntermediateHqlTree tree)
in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\Visitors\ResultOperatorProcessors\ResultOperatorMap.cs:line
24 at
NHibernate.Linq.Visitors.QueryModelVisitor.VisitResultOperator(ResultOperatorBase
resultOperator, QueryModel queryModel,
Int32 index) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\Visitors\QueryModelVisitor.cs:line
125 at
Remotion.Data.Linq.Clauses.ResultOperatorBase.Accept(IQueryModelVisitor
visitor, QueryModel queryModel, Int32
index) at
Remotion.Data.Linq.QueryModelVisitorBase.VisitResultOperators(ObservableCollection1
resultOperators, QueryModel
queryModel) at
Remotion.Data.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel
queryModel) at
NHibernate.Linq.Visitors.QueryModelVisitor.Visit()
in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\Visitors\QueryModelVisitor.cs:line
96 at
NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel
queryModel, VisitorParameters
parameters, Boolean root) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\Visitors\QueryModelVisitor.cs:line
49 at
NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor
sessionFactory) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\NhLinqExpression.cs:line
67 at
NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String
queryIdentifier, IQueryExpression
queryExpression, String
collectionRole, Boolean shallow,
IDictionary2 filters,
ISessionFactoryImplementor factory) in
d:\CSharp\NH\nhibernate\src\NHibernate\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs:line
27 at
NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators(String
expressionStr, IQueryExpression
queryExpression, String
collectionRole, Boolean shallow,
IDictionary2 enabledFilters,
ISessionFactoryImplementor factory) in
d:\CSharp\NH\nhibernate\src\NHibernate\Engine\Query\HQLExpressionQueryPlan.cs:line
34 at
NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String
expressionStr, IQueryExpression
queryExpression, String
collectionRole, Boolean shallow,
IDictionary2 enabledFilters,
ISessionFactoryImplementor factory) in
d:\CSharp\NH\nhibernate\src\NHibernate\Engine\Query\HQLExpressionQueryPlan.cs:line
23 at
NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String
expressionStr, IQueryExpression
queryExpression, Boolean shallow,
IDictionary2 enabledFilters,
ISessionFactoryImplementor factory) in
d:\CSharp\NH\nhibernate\src\NHibernate\Engine\Query\HQLExpressionQueryPlan.cs:line
17 at
NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression
queryExpression, Boolean shallow,
IDictionary2 enabledFilters) in
d:\CSharp\NH\nhibernate\src\NHibernate\Engine\Query\QueryPlanCache.cs:line
88 at
NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression
queryExpression, Boolean shallow) in
d:\CSharp\NH\nhibernate\src\NHibernate\Impl\AbstractSessionImpl.cs:line
302 at
NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression
queryExpression) in
d:\CSharp\NH\nhibernate\src\NHibernate\Impl\AbstractSessionImpl.cs:line
258 at
NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression
expression, IQuery& query,
NhLinqExpression& nhQuery) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\NhQueryProvider.cs:line
42 at
NHibernate.Linq.NhQueryProvider.Execute(Expression
expression) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\NhQueryProvider.cs:line
25 at
NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression
expression) in
d:\CSharp\NH\nhibernate\src\NHibernate\Linq\NhQueryProvider.cs:line
102 at
Remotion.Data.Linq.QueryableBase1.GetEnumerator()
at
System.Collections.Generic.List1..ctor(IEnumerable1
collection) at
System.Linq.Enumerable.ToList[TSource](IEnumerable`1
source) at
TestUsingDevelopmentDataBase.Moch.BillOfSale.Data.FormRepositoryTests.Can_Get_Forms_Where_CorporationNumber_Is_510778087_Metohd1()
in
D:\Dev\NCommon\Moch.BillOfSale\Moch.BillOfSale.NHibenate.Tests\FormRepositoryTests.cs:line
207
The problem could be circumvented in a less well, as follows:
[Test]
public void Can_Get_Forms_Where_CorporationNumber_Is_510778087_Metohd2()
{
var CorporationNumber = "513514950";
var list2 = sellerRepository
.Where(x => x.CorporationNumber == CorporationNumber)
.Fetch(x => x.Form).ThenFetch(x => x.Log)
.Take(10).ToList().Select(x => x.Form);
CollectionAssert.IsNotEmpty(list2);
}
But of course we all prefer the elegant way and want to understand what lies behind the problem
I think Nhibernate doesn't like you fetching after a select. I ran into a null reference exception just like you did.
See my question here about it.
In Linq-to-Nhibernate, is it possible to use .Fetch() after a .Select()?
You might be able to .Select(x => x.Form) after your fetching in your second example before you .ToList() it, too.
I'm using Nhibernate 3.2 and this is still an issue. There should be a proper 'you can't fetch after a select' exception or something to spare us some pain.