-->
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: Left outer join problem -- urgent!!! Migration issue)
PostPosted: Thu Aug 11, 2005 7:40 am 
Newbie

Joined: Thu Aug 11, 2005 7:28 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3

Recently I have migrated my application from Hibernate 2 to Hibernate 3. Earlier i had queries which made use of "=*" for joins.

BEFORE

select
insti.institutionName,
from
compass.domain.Institution insti,
compass.domain.InstitutionLocation loc,
compass.domain.InstitutionDispCycle disp
where
disp.institutionLocationId =* loc.institutionLocationId


NOW since i have shifted to Hibernate 3 i have to use LEFT OUTER JOIN . The same query now gets converted like this.

select
insti.institutionName,
from
compass.domain.Institution insti,
compass.domain.InstitutionLocation loc left outer join
compass.domain.InstitutionDispCycle disp

When i try to bring up the application, the queries are parsed and i get the following Exception.

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException: null
java.lang.NullPointerException
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:264)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3022)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2841)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2719)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:513)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:371)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388)


Top
 Profile  
 
 Post subject: Some more addition
PostPosted: Thu Aug 11, 2005 9:12 am 
Newbie

Joined: Thu Aug 11, 2005 7:28 am
Posts: 2
I tried working my way out.. and found the following

The domain InstitutionLocation has a many to one association with another domain DosageType

So I modified the query to check the outcome.The query i wrote was

select
insti.institutionName,
insti.addressNoOrName,
insti.addressStreet,
insti.institutionId
from
compass.domain.Institution as insti,
compass.domain.InstitutionLocation as loc left outer join loc.dosageSystemType as dos


and it worked!!!!! It got parsed/validated.

the HBM of InstitutionLocation is as follows

<many-to-one name="dosageSystemType" class="compass.domain.DosageSystemType" lazy="false">
<column name="DOSAGE_SYSTEM_TYPE_ID" />
</many-to-one>


Does that mean that i need to have associations to be present in case i want to join 2 tables through HQL?..

I am searching for more.. Any inputs from your side?
[/i]


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.