Announcement Announcement Module
Collapse
No announcement yet.
Hibernate Issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate Issue

    Hi All,

    I am trying to get hibernate+spring work but I am having difficulty. Any help is much appreciated.

    Following is the error that I get:
    11:31:45,557 WARN [JDBCExceptionReporter] SQL Error: 936, SQLState: 42000
    11:31:45,557 ERROR [JDBCExceptionReporter] ORA-00936: missing expression

    11:31:45,577 WARN [JDBCExceptionReporter] SQL Error: 936, SQLState: 42000
    11:31:45,577 ERROR [JDBCExceptionReporter] ORA-00936: missing expression

    11:31:45,577 ERROR [JDBCExceptionReporter] Could not execute query
    java.sql.SQLException: ORA-00936: missing expression

    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:2 89)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol .java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe (TTC7Protocol.java:830)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery( OracleStatement.java:2391)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:2672)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:589)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Query(OraclePreparedStatement.java:527)
    at org.apache.commons.dbcp.DelegatingPreparedStatemen t.executeQuery(DelegatingPreparedStatement.java:92 )
    at net.sf.hibernate.impl.BatcherImpl.getResultSet(Bat cherImpl.java:87)
    at net.sf.hibernate.loader.Loader.getResultSet(Loader .java:800)
    at net.sf.hibernate.loader.Loader.doQuery(Loader.java :189)
    at net.sf.hibernate.loader.Loader.doQueryAndInitializ eNonLazyCollections(Loader.java:133)
    at net.sf.hibernate.loader.Loader.doList(Loader.java: 955)
    at net.sf.hibernate.loader.Loader.list(Loader.java:94 6)
    at net.sf.hibernate.hql.QueryTranslator.list(QueryTra nslator.java:846)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl .java:1543)
    at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.jav a:39)
    at org.springframework.orm.hibernate.HibernateTemplat e$22.doInHibernate(HibernateTemplate.java:416)
    at org.springframework.orm.hibernate.HibernateTemplat e.execute(HibernateTemplate.java:176)
    at org.springframework.orm.hibernate.HibernateTemplat e.executeFind(HibernateTemplate.java:196)
    at org.springframework.orm.hibernate.HibernateTemplat e.find(HibernateTemplate.java:413)

    Hibernate does not seem to construct the SQL properly. Following is the SQL output that I got:
    11:31:45,256 INFO [STDOUT] Hibernate: select from

    Following is my HQL:
    results = (List) getHibernateTemplate().find("from Sample");

    Please do forward your suggestions...

    Thanks
    Kris

  • #2
    Make sure you have properly configured Hibernate for the oracle dialect, although what it's leaving out doesn't seem to be at all Oracle specific. I would also double check the mappings.

    Comment


    • #3
      Colin,

      Thank you the reply. Following is my hibernate mapping:


      <hibernate-mapping package="com.voxware.logoff.orm">
      <class name="NgvSample" table="NGV_SAMPLE">
      <id
      column="APPLICATIONNAME"
      name="Applicationname"
      type="string"
      >
      <generator class="vm" />
      </id>
      <property
      column="WORKFLOWID"
      length="22"
      name="Workflowid"
      not-null="false"
      type="integer"
      />
      </class>
      </hibernate-mapping>

      I could not see anything wrong with the mapping. Let me know if you have further suggestions.

      Thanks
      Kris

      Comment


      • #4
        Without looking too deeply, in your query

        results = (List) getHibernateTemplate().find("from Sample");

        you have referenced class Sample

        but in your mapping

        <class name="NgvSample" table="NGV_SAMPLE">

        you have reference class NgvSample

        These need to be the same, so the query should read:

        results = (List) getHibernateTemplate().find("from NgvSample");

        Comment

        Working...
        X