users@glassfish.java.net

Help me : about ReadAllQuery and Vector argumants

From: <glassfish_at_javadesktop.org>
Date: Wed, 07 Nov 2007 17:15:18 PST

Hi, Guru

[Environment]
Solaris9
Glassfish V2 B58-fcs

[Question]

Can I use Vector argumants in EJBQL of toplink essentials?
When I executed the below program, I found error.

<snipped>
// First define the query
        ReadAllQuery theQuery = new ReadAllQuery();
        theQuery.setReferenceClass(Table0011.class);
        theQuery.setEJBQLString("SELECT OBJECT(o) FROM Table0011 o WHERE o.col2 = ?1");

// Next define the Arguments
        Vector<String> testArguments = new Vector<String>();
        testArguments.add("value1");

// Finally execute the query passing in the arguments
        Vector returnedObjects
           = (Vector)serversession.executeQuery(theQuery, testArguments);

<snipped>

[ Error Stack Trace ]

TopLink Finer]: 2007.11.08 10:05:14.578--ClientSession(2719739)--Thread(Thread[main,5,main])--acquire unit of work: 23668144
Local Exception Stack:
Exception [TOPLINK-6003] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.QueryException
Exception Description: The number of arguments provided to the query for execution does not match the number of arguments in the query definition.
Query: ReadAllQuery(Table0011)
        at oracle.toplink.essentials.exceptions.QueryException.argumentSizeMismatchInQueryAndQueryDefinition(QueryException.java:214)
        at oracle.toplink.essentials.queryframework.DatabaseQuery.rowFromArguments(DatabaseQuery.java:1358)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:922)

Thank you veru much.
[Message sent by forum member 'wildrose99' (wildrose99)]

http://forums.java.net/jive/thread.jspa?messageID=244437