-->
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: outer or full join must be follow
PostPosted: Tue Jul 15, 2008 3:41 am 
Newbie

Joined: Sun May 18, 2008 1:21 pm
Posts: 13
My Query

any type of join gives error where as if i use table1,table 2 and use where clause it works.
i.e this query works

select w.WellName from AM.Library.AMWell as w , AM.Library.AMOperator op
where w.Operator.Id = op.Id and op.Id = 5020


Queries that didnt work

select w.WellName from AM.Library.AMWell as w inner join AM.Library.AMOperator op on w.OperatorId = op.Id

OR

select w.WellName from AM.Library.AMWell as w inner join AM.Library.AMOperator op on w.Operator.Id = op.Id

OR

select w.WellName from AM.Library.AMWell as w inner join AM.Library.AMOperator op where w.OperatorId = op.Id

This is the exception that i got in both ways

NHibernate.QueryException: outer or full join must be followed by path expression [select w.WellName from AM.Library.AMWell as w inner join AM.Library.AMOperator op on w.OperatorId = op.Id
]
at NHibernate.Hql.FromParser.Token(String token, QueryTranslator q)
at NHibernate.Hql.ClauseParser.Token(String token, QueryTranslator q)
at NHibernate.Hql.PreprocessingParser.Token(String token, QueryTranslator q)
at NHibernate.Hql.ParserHelper.Parse(IParser p, String text, String seperators, QueryTranslator q)
at NHibernate.Hql.QueryTranslator.Compile()
at NHibernate.Hql.QueryTranslator.Compile(ISessionFactoryImplementor factory, IDictionary replacements, Boolean scalar)
at NHibernate.Impl.SessionFactoryImpl.GetQuery(String queryString, Boolean shallow) at Ayende.NHibernateQueryAnalyzer.Model.Project.HqlToSql(String hqlQuery, IDictionary parameters)
at Ayende.NHibernateQueryAnalyzer.UserInterface.Presenters.QueryPresenter.TranslateHql()



Here is my mapping file


<class name="AM.Library.AMWell, AM.Library" table="AM_Well">
<id name="WellId" column="WellId">
<generator class="identity" />
</id>
<property name="WellName" column="WellName" />
<property name="OperatorId" column="OperatorId" />
<property name="WellNumber" column="WellNumber" />
<many-to-one name="Operator" class="AM.Library.AMOperator, AM.Library" column="OperatorId" cascade="none" update="false" insert="false" />
</class>


<class name="AM.Library.AMOperator, AM.Library" table="ET_Operator">
<id name="Id" column="ID">
<generator class="assigned" />
</id>
<property name="Name" column="OperatorID" />
<property name="Remarks" column="Operator" />
</class>



I am using NHibernate version 1.0.2, Windowx XP, .net 2.0, sqlserver 2005 express


many thanks in advance

Zafar Ullah


Top
 Profile  
 
 Post subject: outer or full join must be followed by path expression
PostPosted: Tue Jul 15, 2008 5:22 am 
Newbie

Joined: Mon Jul 14, 2008 5:48 am
Posts: 5
Hi

Please change the query as mentioned below.

select w.WellName from AM.Library.AMWell w inner join AM.Library.AMOperator op on w.OperatorId = op.Id

In addition, in the mapping file table name is AM_WELL and in quey its AMWELL. Correct that.

Also try this blog.

http://forum.hibernate.org/viewtopic.php?t=956459

NOTE: DO not forget to rate if this is helpful.

Regards,


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 15, 2008 11:03 am 
Newbie

Joined: Sun May 18, 2008 1:21 pm
Posts: 13
From NHUsers group of google i got this reply and it works.

http://groups.google.com/group/nhusers/ ... 84eb?hl=en


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.