Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problem with Oracle CONNECT BY

Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a native sql query using the Oracle CONNECT BY clause. However, upon execution I see a SQLException stating Unexpected token: START. I tried tweaking the named query syntax but in vain.
The mapping file containing the named query is like this:

<class name=""
<id name="id" type="long">
<column name="ACCT_NUM_HSTRY_ID"/>
<generator class="sequence">
<param name="sequence">ACCT_NUM_HSTRY_ID_SEQ</param> </generator>
<property name="oldAccountNumber" type="string" not-null="true">
<column name="OLD_ACCT_NUM"/>
<property name="newAccountNumber" type="string" not-null="true">
<column name="NEW_ACCT_NUM"/>
<property name="insertTimeStamp" type="calendar" not-null="true">
<column name="TIME_STMP_ADD" />
<property name="updateTimeStamp" type="calendar" not-null="true">
<column name="TIME_STMP_UPDATE" />

<sql-query name="AccountNumberHistory.findByAccountNumber">
<return alias="anh" class=""/>
start with NEW_ACCT_NUM = :accountNumber

And I call it like this (using Spring):
List<AccountNumberHistory> accountHistories = this.getHibernateTemplate().findByNamedQueryAndNamedParam(
"AccountNumberHistory.findByAccountNumber", "accountNumber", accountNumber);
I am using Hibernate 3.2 version.

Any inputs will be highly appreciated!

Piyush Mattoo
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator does work with no extra tweaking
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic