File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Error: unexpected token: c Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Error: unexpected token: c" Watch "Error: unexpected token: c" New topic
Author

Error: unexpected token: c

John Smith
Ranch Hand

Joined: Aug 21, 2004
Posts: 48
Hi All:

I needed your help!! I am using hibernate 3.3.2.
From the following hql code:
ContactCustomerDAOImpl.java:


I get the following error:
hibernate error:
10:33:28,949 DEBUG ErrorCounter:51 - line 1:110: unexpected token: c
line 1:110: unexpected token: c
at org.hibernate.hql.antlr.HqlBaseParser.atom(HqlBaseParser.java:3520)
at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3216)
at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3098)
at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2818)
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:570)
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2586)
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2449)
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2413)
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2331)
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2296)
at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:2082)
at org.hibernate.hql.antlr.HqlBaseParser.aliasedExpression(HqlBaseParser.java:2249)
at org.hibernate.hql.antlr.HqlBaseParser.selectedPropertiesList(HqlBaseParser.java:1462)
at org.hibernate.hql.antlr.HqlBaseParser.selectClause(HqlBaseParser.java:1365)
at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1106)
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:702)
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:296)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:159)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:274)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
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:597)
at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1293)
at $Proxy15.createQuery(Unknown Source)
at com.dao.impl.ContactCustomerDAOImpl$1.doInHibernate(ContactCustomerDAOImpl.java:28)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343)
at com.dao.impl.ContactCustomerDAOImpl.findContactCustomer(ContactCustomerDAOImpl.java:17)
at com.dao.impl.junit.TestContactCustomerDAOImpl.testContactCustomer(TestContactCustomerDAOImpl.java:14)
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:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



This was suppose to be the Oracle equivalent sql code for the hql code above:

Any hint or help would be greatly appreciated it!!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Line 12 looks fishy to me. Shouldn't OUTER JOIN be followed by a table name?
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2272
    
  28



First of all, what's on column 110 of that query? The stack trace is pointing you to where the problem is. It might help to look at it

Secondly, instead of


why don't you just do

Chandrasekar Venkatraman
Greenhorn

Joined: Aug 23, 2010
Posts: 22

Hi,

Error lies in this line

"c.address,c.city,c.provinceStateId,b.provinceStateCode " +
"c.postal, c.fax " +

See that there's no comma after b.provinceStateCode .
Thjis is the issue. Query looks correct.


Learn to live.. Live to learn..
http://helptotheneeded.blogspot.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error: unexpected token: c
 
Similar Threads
servletunit.struts nullpointer problem
Hibernate - Query Issues With Many-To-One Relationships
TransientObjectException while fetching data.
Hibernate Desing issue
How to insert DateTime with HQL