-->
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: 'with' keyword not recognized?
PostPosted: Wed Mar 22, 2006 5:08 pm 
Newbie

Joined: Mon Jun 27, 2005 11:33 am
Posts: 8
I am trying to do the following in my HQL query:

Code:
left join fetch ms.membershipCoverages as mscov
          with mscov.class = MembershipVendorTierCoverage

Unfortunately, it chokes on the 'with' keyword (error below). Is there a better/safer way to use the discriminator value as a query criteria?

Hibernate version: 3.0.5

Full stack trace of any exception that occurs:
Code:
org.hibernate.hql.ast.QuerySyntaxError: unexpected token: with near line 20, column 11 [
        from com.shps.da.eligibility.Member as mbr
        left join fetch mbr.memberships as ms
        left join fetch ms.medicalClaims as dx
        left join fetch dx.providerData
        left join fetch dx.visit
        left join fetch dx.medicalClaimTreatments
        left join fetch dx.categoryOfService
        left join fetch dx.icd9Diagnosis1
        left join fetch dx.icd9Diagnosis2
        left join fetch dx.icd9Diagnosis3
        left join fetch ms.rxClaims as rx
        left join fetch rx.providerData
        left join fetch mbr.cases mcase
        inner join fetch mcase.serviceProgram
        inner join fetch mcase.serviceProgramStatus
        left join fetch mcase.closureDisposition
        left join fetch ms.visits
        left join fetch ms.membershipCoverages as mscov
          with mscov.class = 'MembershipVendorTierCoverage'
        where mbr.id = :memberId
    ]
   at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
   at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
   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)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:800)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:726)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:555)
   at com.shps.da.dao.HibernateSessionTest.testGetSession(HibernateSessionTest.java:25)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)


Name and version of the database you are using: Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 12:05 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You need "where", not with.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 12:07 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
That is, the condition goes into the normal where clause, it doesn't get its own with clause.


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.