Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #180

Re: JPA Calling an Oracle

From "Stanimir Stamenkov" <stanimir.stamenkov@THRWHITE.remove-dii-this>
Subject Re: JPA Calling an Oracle
Message-ID <g2r9hd$t4b$1@registered.motzarella.org> (permalink)
Newsgroups comp.lang.java.databases
Date 2011-04-27 15:22 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.databases
Thu, 12 Jun 2008 16:29:39 +0300, /Stanimir Stamenkov/:

>    Query query = em.createNativeQuery("{ ? = "
>            + "call MY_FUNCTION(?,?,?,?,?,?,?) }");
> 
>    query.setParameter(1, null);   // XXX: registerOutParameter ?
>    query.setParameter(2, ...);
>    ...
>    query.setParameter(7, ...);
> 
>    List result = query.getResultList();
> 
> I don't know how I can register (and later get) the first parameter as 
> OUT parameter, pretty much like one could do with JDBC 
> (java.sql.CallableStatement), and I'm getting an exception as:
> 
> java.sql.SQLException: Missing IN or OUT parameter at index:: 9

The last line actually states:

java.sql.SQLException: Missing IN or OUT parameter at index:: 8

The "index:: 9" comes from an experiment I've made adding one more 
",?" to the function parameters, but seems no matter how many 
question marks I add it always asks for an additional OUT one.  If I 
don't add additional ",?" and try to set:

     query.setParameter(8, ...);

I get an "java.lang.IndexOutOfBoundsException: Remember that ordinal 
parameters are 1-based!" at that line.

-- 
Stanimir

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.databases | Previous | Next | Find similar


Thread

Re: JPA Calling an Oracle "Stanimir Stamenkov" <stanimir.stamenkov@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000

csiph-web