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: Nhibernate.QueryException Somebody reply Thanks?
PostPosted: Wed Aug 30, 2006 11:55 am 
Newbie

Joined: Tue Aug 29, 2006 9:51 am
Posts: 8
"select A.Id from TbFeedItem A Where A.FeedLibid='711' and lower(A.Url)='http://feeds.feedburner.com/~r/alternativemedicineandmeditationnewsweblog/~3/12843564/meditation-balancing-act.html' and lower(A.Title)='meditation: a balancing act : hindustantimes.com'"

what is wrong with query, some time this query works fine for other records and fails for some. Why?

Thanks in Advance.
KT


Last edited by tandon_k on Fri Sep 01, 2006 2:45 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: What is going on?
PostPosted: Fri Sep 01, 2006 2:44 pm 
Newbie

Joined: Tue Aug 29, 2006 9:51 am
Posts: 8
Hey Guys ,
what is wrong with this query?

select A.Id from DomainManager.BusinessObjects.TbFeedItem A Where A.FeedLibid=301 and A.Url='http://archderm.ama-assn.org/cgi/content/short/142/7/927?rss=1' and A.Title='CORRESPONDENCE: A Randomized, Placebo-Controlled, Double-blind Trial Comparing Narrowband UV-B Plus 0.1% Tacrolimus Ointment With Narrowband UV-B Plus Placebo in the Treatment of Generalized Vitiligo'

I get this error:
The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

in function at ib bold below :

public static object GetConstantValue( string typeName, string fieldName )
{
System.Type clazz = System.Type.GetType( typeName, false );

if( clazz == null ) return null;

try
{
return clazz.GetField( fieldName ).GetValue( null );
}
catch( Exception )
{
return null;
}
}

===========================================
other query:
Not all named parameters have been set: [] [select A.Id from TbFeedItem A Where A.FeedLibid=968 and A.Url='http://www.biomedcentral.com/1471-2482/6/6' and A.Title='Minimally invasive ''step-up approach'' versus maximal necrosectomy in patients with acute necrotising pancreatitis (PANTER trial): design and rationale of a randomised controlled multicenter trial [ISRCTN38327949]']

I get the above error at this function (line below in bold):
protected void VerifyParameters()
{
if ( actualNamedParameters.Count != namedParameters.Count + namedParameterLists.Count )
{
Set missingParams = new ListSet( actualNamedParameters );
missingParams.RemoveAll( namedParameterLists.Keys );
missingParams.RemoveAll( namedParameters.Keys );
throw new QueryException( "Not all named parameters have been set: " + CollectionPrinter.ToString( missingParams ), QueryString );
}

if ( positionalParameterCount != values.Count )
{
throw new QueryException( string.Format( "Not all positional parameters have been set. Expected {0}, set {1}", positionalParameterCount, values.Count ),
QueryString );
}

for ( int i = 0; i < values.Count; i++ )
{
if ( values[i] == UNSET_PARAMETER || types[i] == UNSET_TYPE )
{
throw new QueryException( string.Format( "Not all positional parameters have been set. Found unset parameter at position {0}", i),
QueryString );
}
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 03, 2006 7:16 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
NHibernate uses a simple parser which easily gets confused if you embed literal values in the query. Use parameters instead.


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.