Hi,
I want to bind a collection object to a positional parameter in an HQL statement as:
from SomutKart k where k.barkodNo in elements(?)
I want to bind a collection object to the positional parameter. But the code throws and SQLException. Is this not a legal HQL action?
Hibernate version:2
Mapping documents:
Code between sessionFactory.openSession() and session.close():
getHibernateTemplate().find("from SomutKart k where k.barkodNo in elements(?) order by k.adres1, k.adres2, k.adres3, k.barkodNo", kartlarinBarkodlari);
this is Spring equivalent to session.find(...)
Full stack trace of any exception that occurs:
org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: ORA-00907: missing right parenthesis
java.sql.SQLException: ORA-00907: missing right parenthesis
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:242)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:554)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1478)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:677)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2660)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:457)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:387)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
at net.sf.hibernate.loader.Loader.list(Loader.java:941)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at org.springframework.orm.hibernate.HibernateTemplate$24.doInHibernate(HibernateTemplate.java:521)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:243)
at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:263)
at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:512)
at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:507)
at mil.tsk.kybs.servis.dao.HibernateKartDao.findKartByBarkodNo(HibernateKartDao.java:168)
Name and version of the database you are using:
The generated SQL (show_sql=true) (abridged):
select somutkart0_.KART_N_REFNO as KART_N_R1_, somutkart0_.KART_V_BARKOD as KART_V_B6_, somutkart0_.KART_N_KART_AILESI_REFNO as KART_N_26_ from KART_TAB somutkart0_ where (somutkart0_.KART_V_BARKOD in ?.elements ) order by somutkart0_.KKISI_V_ADRES1 ,
Debug level Hibernate log excerpt:DEBUG
Thanks,
Mert Nuhoglu
http://jroller.com/page/mnuhoglu/