-->
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: Polymorphic query on Interface: What am I missing
PostPosted: Fri Apr 07, 2006 8:44 pm 
Newbie

Joined: Fri Apr 07, 2006 8:33 pm
Posts: 6
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
NHibernate, actually, 1.0

Mapping documents:

(plain, nothing special, this part is working)

I have a concrete class "DocumentVersion" which is mapped and everything works fine.

DocumentVersion implements an Interface: IDocumentVersion:

Code:
public class DocumentVersion : IDocumentVersion


Code between sessionFactory.openSession() and session.close():
Code:
ISession nhs = ...

// Works great!
IList docVersions = nhs.Find("FROM DocumentVersion");

// Works!

...

// Throws exception
IList docVersions = nhs.Find("FROM IDocumentVersion");

Throws:
[NHibernate.QueryException]: {"undefined alias or unknown mapping: Usva [FROM IDocumentVersion ]" }

// Also tried, but throws exception
IList docVersions = nhs.Find("FROM Customer.Project.Core.Entities.IDocumentVersion");

Throws:
[NHibernate.QueryException]: {"undefined alias or unknown mapping: Usva [FROM Customer.Project.Core.Entities.IDocumentVersion ]" }


I've tried putting the <imports> in my mapping files, but to no avail.

I must be doing something wrong, because the docs (11.6 Polymorphic Queries) says:

Quote:
NHibernate queries may name any .NET class or interface in the from clause. The query will return instances of all persistent classes that extend that class or implement the interface.
.

Any advice?


Top
 Profile  
 
 Post subject: Re: Polymorphic query on Interface: What am I missing
PostPosted: Fri Apr 07, 2006 9:03 pm 
Newbie

Joined: Fri Apr 07, 2006 8:33 pm
Posts: 6
cmyers wrote:
Any advice?


Gah... class case of Stupid User Failure. I have bigger problems than this and it's caused by something else (stupid that I did).

I don't have it working yet, but at this point, I'm 99.9% convinced it's not NHibernate's fault. Please diregard.


Top
 Profile  
 
 Post subject: Re: Polymorphic query on Interface: What am I missing
PostPosted: Fri Apr 07, 2006 9:32 pm 
Newbie

Joined: Fri Apr 07, 2006 8:33 pm
Posts: 6
cmyers wrote:
cmyers wrote:
Any advice?


Ok, I got it working! yea!

I did have to add an <imports> to get it to work, though. That kinda stinks, but at least it works.


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.