Note that there are some explanatory texts on larger screens.

plurals
  1. POgetting org.hibernate.hql.internal.ast.QuerySyntaxException error
    primarykey
    data
    text
    <p>As mentioned above, I'm getting the exception mentioned above.</p> <p>Can you please help? thanks</p> <hr> <p>I've looked at various guides/tutorials and they don't really tell you what is the mapping required to run such examples. or The examples I've seen doesn't really have anything that involves retrieving data. It's mostly about insert/update and delete.</p> <p><strong>an example from the jboss doc</strong> (http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html)</p> <pre><code>select foo from Foo foo, Bar bar where foo.startDate = bar.date </code></pre> <p><strong>This is my HQL:</strong></p> <pre><code>sessionFactory.getCurrentSession().createQuery("from Staff staff, Url url where (staff.id = url.id (+))"); </code></pre> <p>This my mapping XML</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt; &lt;hibernate-mapping&gt; &lt;class name="org.flinders.staffdirectory.models.database.Staff" table="teld_summary"&gt; &lt;id name="id" column="telsumm_id" type="string" /&gt; &lt;property name="title" column="telsumm_name_title" type="string" /&gt; &lt;property name="firstname" column="telsumm_preferred_name" type="string" /&gt; &lt;property name="surname" column="telsumm_surname" type="string" /&gt; &lt;one-to-one name="url" class="org.flinders.staffdirectory.models.database.Url" /&gt; &lt;/class&gt; &lt;class name="org.flinders.staffdirectory.models.database.Url" table="teld_urls"&gt; &lt;id name="id" column="telurl_id"&gt; &lt;generator class="foreign"&gt; &lt;param name="property"&gt;staff&lt;/param&gt; &lt;/generator&gt; &lt;/id&gt; &lt;one-to-one name="staff" class="org.flinders.staffdirectory.models.database.Staff" constrained="true" /&gt; &lt;property name="url" column="url" /&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p><strong>my error</strong></p> <pre><code>org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ) near line 1, column 142 [from org.flinders.staffdirectory.models.database.Staff staff, org.flinders.staffdirectory.models.database.Url url where (staff.id = url.id (+)) and (staff.surnameSearch like 'A%') order by surname, firstname] org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47) org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79) org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:276) org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180) org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:105) org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:80) org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:221) org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:199) org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1735) org.flinders.staffdirectory.dao.StaffDAOImpl.searchForStaff(StaffDAOImpl.java:49) org.flinders.staffdirectory.services.SearchServiceImpl.searchForStaff(SearchServiceImpl.java:26) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:601) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) $Proxy13.searchForStaff(Unknown Source) org.flinders.staffdirectory.controllers.SearchController.showSearchResults(SearchController.java:33) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:601) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) </code></pre> <p><strong>my staff class</strong></p> <pre><code>package org.flinders.staffdirectory.models.database; import java.util.Date; import org.flinders.staffdirectory.models.database.Url; public class Staff { private String id; private String title; private String firstname; private String surname; private Url url; public String getId() { return id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public Url getUrl() { return url; } public void setUrl(Url url) { this.url = url; } } </code></pre> <p><strong>my Url class</strong></p> <pre><code>package org.flinders.staffdirectory.models.database; import org.flinders.staffdirectory.models.database.Staff; public class Url { private String id; private String url; private Staff staff; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public Staff getStaff() { return staff; } public void setStaff(Staff staff) { this.staff = staff; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload