-->
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.  [ 2 posts ] 
Author Message
 Post subject: It works in Java but not in .NET (Named Query problem...)
PostPosted: Mon May 05, 2008 12:35 pm 
Newbie

Joined: Mon May 05, 2008 12:20 pm
Posts: 2
In Hibernate for Java we can write a named query in "hbm.xml" and select diferents properties from diferents entities and retrieve a collection of a specific class result for mapping this query. It is like:

select MyNamespace.MyResult(classA.propertyA, classB.propertyB)
from classA........

It works in java, but in .net I got "class not found: MyResult...."

Has the NHibernate suport for this feature? What I have to do?

thanks!


Top
 Profile  
 
 Post subject: If someone has the same problem.....
PostPosted: Fri May 09, 2008 8:09 am 
Newbie

Joined: Mon May 05, 2008 12:20 pm
Posts: 2
I found other way to do the same thing...

The solution is select in named query the properties from diferents entities that I want, and then in the execute method I configure the "SetResultTransformer" in IQuery:

public IList ExecuteCustomQuery(string queryName, string[] parameterNames, object[] parameterValues, Type resultType)
{

AliasToBeanConstructorResultTransformer res = new AliasToBeanConstructorResultTransformer(resultType.GetConstructors()[0]);

IQuery query = NHibernateSession.GetNamedQuery(queryName).SetResultTransformer(res);


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