-->
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: Odd query exception
PostPosted: Thu Nov 17, 2005 11:57 am 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
I've got what I think of as a relatively simple hql query, but it's throwing an exception that doesn't seem to make sense to me...

When I execute the query (embedded in the exception details) I get the following exception:

Quote:
[14828] [NHibernate]
[14828] QueryException
[14828] Incorrect query syntax [SELECT new PAPA.Types.InputProfile( i, i.ParentUser.id) FROM Papa.Framework.Core.Entities.InputProfile i WHERE (i.Deleted = false) AND (i.InputInterface = :InputInterfaceFilter) AND (i.ParentUser.id = :UserFilter)]
[14828] at NHibernate.Hql.QueryTranslator.Compile()
[14828] at NHibernate.Hql.QueryTranslator.Compile(ISessionFactoryImplementor factory, IDictionary replacements, Boolean scalar)
[14828] at NHibernate.Impl.SessionFactoryImpl.GetQuery(String queryString, Boolean shallow)
[14828] at NHibernate.Impl.SessionImpl.GetQueries(String query, Boolean scalar)
[14828] at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)
[14828] at NHibernate.Impl.QueryImpl.List()
[14828] at Papa.Framework.Core.Query.List() in C:\Documents and Settings\Symon\My Documents\Visual Studio Projects\Xpedite\PAPA\Papa.Framework.Core\Query.cs:line 191
[14828] [mscorlib]
[14828] ArgumentException
[14828] Item has already been added. Key in dictionary: "i" Key being added: "i"
[14828] at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
[14828] at System.Collections.Hashtable.Add(Object key, Object value)
[14828] at NHibernate.Hql.FromParser.Token(String token, QueryTranslator q)
[14828] at NHibernate.Hql.ClauseParser.Token(String token, QueryTranslator q)
[14828] at NHibernate.Hql.PreprocessingParser.Token(String token, QueryTranslator q)
[14828] at NHibernate.Hql.ParserHelper.Parse(IParser p, String text, String seperators, QueryTranslator q)
[14828] at NHibernate.Hql.QueryTranslator.Compile()
[14828]


It's saying that the key 'i' has already been added...where!?! I've got plenty of other queries that are similar and I've never seen this before.

Anyone got any ideas as to what's going wrong?

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 9:16 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 11:09 pm
Posts: 23
I'm getting the same error from the following query:

Quote:
from Generator gen where gen.Industry.id = :industryId


Quote:
Incorrect query syntax [from WasteLinkWebService.Entity.Generator.Generator gen where gen.Industry.id = :industryId] --> Item has already been added. Key in dictionary: "gen"; Key being added: "gen"


Seems very strange. I'm using NHibernate 1.0.1. Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 11:13 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 11:09 pm
Posts: 23
Opps. In my case I was missing the mapping definition for the many-to-one: Generator=>Industry relation.

It would be nice if the exception info could be improved a little. The current hashtable exception sent me on a bit of a wild goose chase for query syntax errors.

Cheers


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.