-->
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: "in expected" error on simple query
PostPosted: Mon Jun 28, 2004 1:00 pm 
Newbie

Joined: Mon Jun 28, 2004 12:41 pm
Posts: 3
I'm trying to run a simple query and am getting an error that I don't understand. I've used something just like it in other projects and it has worked. I've checked everything that I know to check and I'm at a dead end. I've looked at the forum but nothing has helped. what have I missed? I'm using Oracle 9i and JBoss 3.2.4. Thanks!!!!

hibernate file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Maping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
   
<hibernate-mapping>
  <class name="com.vartec.corporate.common.valueObjects.CompanyValueObject" table="corp_company">
    <id name="oidAsLong" column="company_id" type="long">
    <generator class="assigned">
    </generator>
    </id>
    <property name="name" type="string"/>
    <property name="createdBy" column="created_by" type="string"/>
    <property name="createdDate" column="created_date" type="date"/>
    <property name="modifiedBy" column="modified_by" type="string"/>
    <property name="modifiedDate" column="modified_date" type="date"/>


 
   
   
  </class>
</hibernate-mapping>



Java Code:

Code:
   Collection rows;

      Session session = HibernateUtils.getInstance().getSession();

      try
      {
         Query query =
            session.createQuery("from CompanyValueObject a");
         rows = query.list();

      }
      catch (Exception e)
      {
         logger.error(e);
         throw new ServiceException(e);
      }

      HibernateUtils.getInstance().closeSession(session);

      return rows;



Error:


Code:
11:38:09,734 ERROR [CompanyHandler]
in expected: a [from CompanyValueObject a]

net.sf.hibernate.QueryException: in expected: a [from CompanyValueObject a]
        at net.sf.hibernate.hql.FromParser.token(FromParser.java:102)
        at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
        at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142)
        at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
        at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
        at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
        at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293)
        at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1493)
        at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1464)
        at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
        at com.vartec.corporate.server.handlers.CompanyHandler.searchAllCompany(CompanyHandler.java:49)
        at com.vartec.corporate.common.ejb.CorporateServiceAgentBean.searchAllCompany(CorporateServiceAgentBean.java:57)
        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:324)
        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:147)
        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
        at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
        at org.jboss.ejb.Container.invoke(Container.java:713)
        at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375)
        at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83)
        at $Proxy64.searchAllCompany(Unknown Source)
        at com.vartec.corporate.web.delegate.CorporateServiceDelegate.searchAllCompany(CorporateServiceDelegate.java:47)
        at com.vartec.corporate.web.action.company.SearchCompanyAction.execute(SearchCompanyAction.java:37)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:587)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:66)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
        at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:92)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
        at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:490)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
        at java.lang.Thread.run(Thread.java:534)
11:38:09,764 INFO  [CachedConnectionManager] Closing a connection for you.  Please close them yourself: org.jboss.resource.adapter.jdbc.Wrap
pedConnection@992725


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 1:17 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
either
1. your mapping file is not found (check the logs)
2. use the fully qualified class name in HQL

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 3:49 pm 
Newbie

Joined: Mon Jun 28, 2004 12:41 pm
Posts: 3
after changing the code to a session.find() it started giving me a class not found error. Turns out that I had not initialized the mapping. Thanks alot!!!!


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.